I didnt mean to put the spolier lines there. grey bars showed up and I didnt know what they were or how to remove them.
But this is what im trying to Accomplish.
I have a list of datasets that are sequentially names with year and month. Ex. Perf_200504 - Perf_201801
I have a list of dates in another table by client.
I am trying to stack client relevant data.
So if client 1234 date is 01/01/2016, stack all client information from each dataset.
So I need to loop through each dataset from the point of a specific date and stack all later datasets.
Hope this makes sense
OK, some key information then:
Can I assume from your example (where the date is 01/01/2016) that you want to extract everything from Perf_201601, everything from Perf_201602, all the way through everything from Perf_201801?
One way to go:
%macro one_client (client=);
%local starting_ym dataset_list;
data start;
set clients;
where client = &client;
call symputx('starting_ym', catt(year(date), month(date));
run;
proc sql;
select distinct 'perf.' || memname into : dataset_list separated by ' '
from dictionary.tables
where substr(upcase(memname), 1, 5)) = 'PERF_' and substr(memname, 6, 6) >= "&starting_ym"
;
quit;
data want;
set &dataset_list;
run;
%mend one_client;
Obviously, it's untested code. Minor tweaks might be needed.
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.