I have the following two datasteps with the first one stacking various datasets together and the second part extracting records and putting them into datasets depending on the month.
*Step 1
data temps.full_clean;
set temps.clean_:
run;
*Step 2
data temps.nov_21 temps.dec_21 temps.jan_22;
set temps.full_clean;
select (paydate_monthyear);
when ("202111") output temps.nov_21;
when ("202112") output temps.dec_21;
when ("202201") output temps.jan_22;
otherwise;
end;
run;One of the issues is when I stack the datasets in the location temps. clean_: to create temps.full_clean it creates a rather large SAS dataset which takes up a lot of space.
What I would like to do is search individually through temps.clean_1 temps.clean_2 temps.clean_3..... and output all records to temps.nov_21 if the criteria in step 2 is met, then look at temps.clean_2 and update temps.nov_21 with the additional records.
I would like to carry this out for the various different months.
Does anyone know an easy way to do this which would result in me not having to create a large temps.full_clean dataset?
If the code you show is producing the result you want, you can skip the first DATA step by using the first DATA step's SET statement in the second DATA step, something like this:
data temps.nov_21 temps.dec_21 temps.jan_22;
set temps.clean_:
select (paydate_monthyear);
when ("202111") output temps.nov_21;
when ("202112") output temps.dec_21;
when ("202201") output temps.jan_22;
otherwise;
end;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.