06-20-2014 07:59 PM
The code below reads multiple csv files into a single SAS dataset. How can I create an ID variable using the name of the csv files?
FILENAME myfiles ("C:\path\*.csv");
INFILE myfiles DSD MISSOVER FIRSTOBS=8;
INPUT record date :mmddyy10. time :time8. BG MeterSN $;
06-20-2014 08:11 PM
Look at the FILENAME option on INFILE statement. Note that you will need to make two variables as the one referenced in the INFILE statement will be dropped.
Also note that FIRSTOBS will not work correctly in this case as it will only skip the beginning of the first file it opens.