I would be very leery of letting an automated process with Proc Import read my data. As a minimum you should add the guessingrows=max option to have the best chance of consistent data.
Proc Import has to guess at lengths and types of variables and depending on the actual contents the types and lengths may change between files read.
I would suggest reading one file with import, go to the log and extract the data step generated and edit that code. Use the same code to read all of the files just changing input file names and output data set names.
If you go to combine data and get warnings or errors about mismatched data types or truncated character variables don't say you haven't been warned.
You should be able to create a macro variable with today's date in that format.
%let today=%sysfunc(today(),yymmddd10);
And then use the macro variable in the filename.
Datafile ="h:\report &today..csv"
Make sure to have a "extra" period. The first one will be used by macro processor to indicate the end of the macro variable name and the second one will become part of the generated filename.
You could just put the macro function call directly into the string, that will eliminate the need for the macro variable and the extra period.
Datafile ="h:\report %sysfunc(today(),yymmddd10).csv"
I would be very leery of letting an automated process with Proc Import read my data. As a minimum you should add the guessingrows=max option to have the best chance of consistent data.
Proc Import has to guess at lengths and types of variables and depending on the actual contents the types and lengths may change between files read.
I would suggest reading one file with import, go to the log and extract the data step generated and edit that code. Use the same code to read all of the files just changing input file names and output data set names.
If you go to combine data and get warnings or errors about mismatched data types or truncated character variables don't say you haven't been warned.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.