Hi Team,
My requirement is to import many .txt files each with differant layout all at once.And to save them as sas datasets in work library.Can someone please help me on this.Thanks!
NOTE:I cannot make copy of files and store them in one temp location.File sizes are huge
You can write a macro.
How do you know where the files are? Do you have a list, all in a folder?
Where/How is the layout of your text files described?
These are pipe delimited .txt files. and all of them are distributed over 4 folder locations.
1. Can proc import work or will you need a customized data step for each file?
If proc import works you can try and automate it.
Automating Proc import would be fine with me...any idea how to go about it?
The first link I provided is a step by step instruction on how to do exactly that.
You can use a script to determine all the files in the folder (Assuming Windows);
http://support.sas.com/kb/45/805.html
Once those are in a dataset you can call the import macro using call execute.
%macro import_text_file(path, out);
proc import data=&out datafile="&path" dbms=dlm;
delimiter='|'; getnames=yes;
run;
%mend;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.