BookmarkSubscribeRSS Feed
yeppy12
Calcite | Level 5

I have a bunch of .dat daily files that I am trying to turn into historical data sets.  The issue for me is that each of these files is in a daily folder--for example, the files for July 24th are in a folder called 20170724, the files for July 23rd are in a folder called 20170723, etc.  There are several files in each folder: AA.dat, BB.dat, CC.dat, DD.dat, etc.

 

These files go back 10 months, so the backlog is pretty big.  What I do not have time to do is import these files folder by folder.

I’d like to import and append the daily files to one another to create a month-end data set and a yearly data set.  For example, a monthly AA and a YTD AA, a monthly BB and a YTD BB, etc. 

 

Any ideas as to how I can do this?  Any help is greatly appreciated.

2 REPLIES 2
Reeza
Super User

https://github.com/statgeek/SAS-Tutorials/blob/master/Import_all_files_one_type

 

I don't actually recommend my macro above for text files, but the process is the same. There are more efficient codes in various places if you search. 

 

The process is basically, create a list of file by traversing the directorie and then import all at once. 

yeppy12
Calcite | Level 5
Thanks, Reeza, for the help. I will take a look at your macro above and will also keep searching for other code to assist me.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 789 views
  • 0 likes
  • 2 in conversation