09-28-2015 03:07 PM
My name is Chandra. I am not very good at SAS macro especially the looping part and resolving &&&. etc. Here is my problem statement.
I have large number of raw data files (.dat files) stored in a folder in a SAS server. I need a macro that can read each of these rawdata file and create SAS data set for each raw data file and store them in a separate target folder in the SAS server. All these raw data files have same file layout structure. I need to automate this operation so that every week, the macro reads raw data files from the source folder and creates the corresponding SAS dataset and stores them in the target folder in the SAS server. For example, if there are 200 raw data files in a source folder, I want to read them and create 200 SAS datasets one for each rawdata file and save them in a separate target folder. I am not very good at constructing looping statement and also resolving && or &&& etc. How do I do it?
I would highly appreciate your kind assistance in this regard.
09-28-2015 03:10 PM
09-29-2015 09:38 AM
To get a list of files you can use this macro http://www.sascommunity.org/wiki/Filelist_macro once you have the list of files I suggest you use a pattern very well described by @ChrisHemedinger in his blog entry Implement BY processing for your entire SAS program. Well in your case it is not about BY Group processing but more like doing something over a list of values.
Since you need a new library for each SAS data set, have a look at the SAS trick: get the LIBNAME statement to create folders for you
10-02-2015 10:43 PM