Hi all,
I have 5 datasets (Cohort1, Cohort2, Cohort3...).
I have a long program with a macro variable &DATA whenever I am calling one of the datasets above.
Is there a way to write a do loop that will run my entire program on all the cohorts?
Hi,
something like this maybe?
%macro cohort;
%do i=1 %to 5;
data cohort&i;
infile or set statement here, and you can add &var to create variable different for each year;
.....
run;
%end;
/*you can insert your second macro here that will run for each cohort separately*/
%mendcohort;
%cohort;
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!
Submit your idea!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for:
View all other training opportunities.