I am trying to write code in SAS which will loop over a folder full of CSVs. The "Data" folder in the linked file (testcsv.zip) is a sample of those files (6 of them), but in actuality, I have about 6,000 CSVs that I need to iterate over. Each file is formatted the same way, such as:
I need to loop over each of the CSVs in the folder, and do the following:
- output VAR15 (this is the Event identifier - it's a repeated variable in each file, but unique between files)
- output VAR16 (this is a "distance" variable - it's a repeated variable in each file, and there are 10 different distances for each event [50,100,150,etc.])
- run proc univariate for:
- VAR4 (elevation)
- VAR5 (intensity)
- VAR14 (acd)
- run proc univariate for:
and output all statistics available (mean, std, kurtosis, mode, etc. etc.) for each of these variables. So I am looking for an output table that looks like:
The output would have 6,000 rows (one row for each CSV file) and x number of columns (would like all statistics from the univariate command - I believe that is 45, so 45x3 variables + event + distance = 137 columns total).
I'm a newbie to SAS and all the people I know that work with SAS have had trouble coming up with a solution for this problem. Macros have been suggested, but I am having trouble getting very far in writing one. Any help in getting started would be very much appreciated. Other approach suggestions using R or Matlab are welcome! Thank you!