Multiple queries? But why?
You could also use a data step that concatenates variable and creates macro variable at the end of each group id.
Untested but the gist of the idea is there.
Data _null_;
Length var_string $200.;
Set have;
By id;
Retain var_string;
If first.id then call missing(var_string);
Var_string = catt(var_string, value);
If last.id then call symputx('var'|put(id, z3.), var_string);
Run;
The SQL into clause could load everything into one macro variable, but I want to group them into different variables based on the ID. Any suggestions?
Multiple queries? But why?
You could also use a data step that concatenates variable and creates macro variable at the end of each group id.
Untested but the gist of the idea is there.
Data _null_;
Length var_string $200.;
Set have;
By id;
Retain var_string;
If first.id then call missing(var_string);
Var_string = catt(var_string, value);
If last.id then call symputx('var'|put(id, z3.), var_string);
Run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.