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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.