Tuesday 15 July 2014

Mass Convert Multiple SAS datasets into CSV files -


I have around 720 SAS datasets (which are equipped with 720 SAS index files ".sas7bdnx") converted to CSV files.

Would you like to know how to use proc export to change one at a time, but is there any effective way of converting to a SAS program for everyone? All datasets are stored on the local Unix server.

It is quite easy, in order to recognize them in the code, it is incidental to you in some reasonable way.

Here is a simple answer:

 % macro makeCSV (dataset =); Proc Export Data = & amp; Dataset File = "& dataset.ccc" dbms = change csv; Run; * Modify the export if necessary; % MEND CSSV; Proc sql; Select cats ('% makeCSV (dataset =', meemm, ')'): 'Separate from' CSCVil ' Download from where libname = 'YOURLIB' and memname 'FORCSV'; leave; * Or whatever logic identifies these 720 or whatnot datasets; & Amp; MakeCSVlist; * Actually runs Macro calls;   

Now, this is probably quite slow, but it should work. To fast, 720 should not be dataset, but write the code in the data phase by using a dataset, and FILEVAR = option. It becomes very difficult if you have too many numbers (as you have to put a statement), but still you can create a code like I am just using the dictionary column. It will still create 720 csv, but it is very fast because it calls the 720 proc export and avoids its overhead.

No comments:

Post a Comment