Someone is running data for me and saving the output in a sub folder of a Yearly directory. For example, I have a folder called "2020" and the data that is being run for me gets output to subfolders called "Jan062020", "Jan132020", "Jan202020", etc. and within each of these folders are a couple of datasets that always has the same names.
What I'd like to do is create a list of these sub folders that I can then loop over and pull in the datasets into an aggregated file.
I've spent some time Googling but can't find anything that fits my inquiry so I am hoping to find assistance here.
Thanks in advance for your time.
Can you use x-commands in the sas-session?
If yes, you could use something like
filename dirs pipe 'dir "YOUR_PATH" /a:d /b';
data dirs;
length dirName $ 200;
infile dirs;
input dirName;
run;
I don't have access to sas right now, so the code is untested.
Can you use x-commands in the sas-session?
If yes, you could use something like
filename dirs pipe 'dir "YOUR_PATH" /a:d /b';
data dirs;
length dirName $ 200;
infile dirs;
input dirName;
run;
I don't have access to sas right now, so the code is untested.
https://support.sas.com/kb/24/820.html
@GeorgeBonanza wrote:
Someone is running data for me and saving the output in a sub folder of a Yearly directory. For example, I have a folder called "2020" and the data that is being run for me gets output to subfolders called "Jan062020", "Jan132020", "Jan202020", etc. and within each of these folders are a couple of datasets that always has the same names.
What I'd like to do is create a list of these sub folders that I can then loop over and pull in the datasets into an aggregated file.
I've spent some time Googling but can't find anything that fits my inquiry so I am hoping to find assistance here.
Thanks in advance for your time.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.