Randomly select character values for each observation
In the example dataset – SASHELP.HEART, you want to create a new variable – Activity_status and assign one of three values of (‘High’, ‘MEDIUM’, ‘LOW’), at random to each observation. You can achieve these using 2 methods. Method 1: Using an array data heart(drop=id _1-_3 keep=status sex bp_status chol_status activity_status); set sashelp.heart(obs=10); array _{3} $… (0 comment)

Removing dashes and parentheses from phone numbers
Removing dashes and parentheses from phone numbers is one of the common data cleaning activities. This program uses the compress function to remove unwanted characters from a phone number. data phone_number; input Phone $ 1-20; Phone_number=compress(Phone, , 'kd'); datalines; (908)235-4490 (201) 555-77 99 ; title 'Removing dashes and parentheses from phone numbers'; proc print data=phone_number;… (0 comment)

The macro is dynamic to generate multiple Excel files containing the frequency results for each unique BY-group. (e.g., Type). In this SAS example,  PROC SQL SELECT code is embedded inside a macro. The SELECT query processes the column (passed in the macro parameter) then create a macro variable with the number of unique (distinct) value… (0 comment)