From: SAS Swamy on
Hello everyone,
Can someone help me out with the following I am trying to dynamically
combine few data sets and create one final data sets.
Let say , If I have the following data sets – State wise
State_il
State_nj
State_pa …etc
When I try with the normal code .

data combined_st;
set state_il state_ma state_nj state_pa state_NYC;
run;
this is working with no Issue ,

If I try the same dynamically then I am able to assign only the last data
set,
&state_count – will be the count of end of the loop
state_&&state_&loop - will be the values like state_il , state_nj …etc

%macro combined_states();
data combined_states;
%do loop = 1 %to &state_count;
set state_&&state_&loop;
%end;
run;
%mend combined_states;

%combined_states;

With this logic as you could see what ever the last data set only that
data set is assigned to the final data set,
how can I do a while loop on this ? So that I can assign all the data sets
from the loop to one final data set.
Please advice

Thanks,
- Swamy