I failed to use do loop in the following statement.
Label
date_csop1 = 'Date case opened, event1' date_csop2 = 'Date case opened, event2'
date_csop3 = 'Date case opened, event3' date_csop4 = 'Date case opened, event4'
date_csop5 = 'Date case opened, event5' date_csop6 = 'Date case opened, event6'
date_csop7 = 'Date case opened, event7' date_csop8 = 'Date case opened, event8'
date_csop9 = 'Date case opened, event9' date_csop10 = 'Date case opened, event10'
date_cscls1 = 'Date case closed, event1' date_cscls2 = 'Date case closed, event2'
date_cscls3 = 'Date case closed, event3' date_cscls4 = 'Date case closed, event4'
date_cscls5 = 'Date case closed, event5' date_cscls6 = 'Date case closed, event6'
date_cscls7 = 'Date case closed, event7' date_cscls8 = 'Date case closed, event8'
date_cscls9 = 'Date case closed, event9' date_cscls10 = 'Date case closed, event10' ;
Thanks,
The following statement worked.
%MACRO DO_LABEL(count);
%DO Y = 1 %TO &count;
date_csop&Y = "Date case opened, event&Y"
date_cscls&Y = "Date case closed, event&Y"
%END;
%MEND DO_LABEL;
LABEL %DO_LABEL(10);
A data step do loop will not work here but a macro with a %DO loop could work.
Thanks,
The following statement worked.
%MACRO DO_LABEL(count);
%DO Y = 1 %TO &count;
date_csop&Y = "Date case opened, event&Y"
date_cscls&Y = "Date case closed, event&Y"
%END;
%MEND DO_LABEL;
LABEL %DO_LABEL(10);
If this data is generated via a TRANSPOSE you may also want to take advantage of the IDLABEL option.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.