11-28-2017 03:06 PM
11-28-2017 03:14 PM
Are you trying to create a single macro variable or many here? Personally, I find SQL easier to use in these cases.
Multiple macro variables:
Proc sql noprint; Select name into : name1- From sashelp.class; Quit;
Single macro variable, delimited by space:
Proc sql noprint; Select name into :name_list separated by “ “ From sashelp.class; Quit;
11-28-2017 03:22 PM
The following datastep creates a single macro variable for each record in your set and a variable that has the count.
Data _null_; Set sample; mvarname= catt('name',_n_); Call symputx(mvarname,name); call symputx('numnames',_n_); Run;
Old school, as in SAS 6. I would go with @Reeza's Proc SQL most of the time these days.
Need further help from the community? Please ask a new question.