Hello experts,
I am running proc report for a table in rtf. The number of columns are based on a categorical variable in a dataset. Let say a variable has 6 categories.
I have used call symput to get V1 to V6 macro variables.
The question is in column statement how will I detect and provide V1toV6 automatically. If I use another variable it might have 4 categories and then I will hae V1 to V4.
I need something like this,
proc report data=final nowindows headline headskip split='|' ;
column _label_ v1 v2 v3 v4 v5 v6; /* This should be automatic like v1-v&last because I have macro variable having last number (&last) */
Thanks in advance.
?????????????????????????????????
You can use a "SAS Variables List".
column _label_ V:; /*notice the colon*.
define V: / options.....
You will need to make sure the V variables are in the order you like.
Otherwise you can use more code perhaps MACRO to figure out the list and supply it with a macro variable.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.