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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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: