if I need sas to read in txt file with header and trailer, how to do it?
I saw some program it has the followings:
%LET HEADER_IND=N;
%LET TRAILER_IND=N;
do in my case I will put 'Y' instead?
what else do I need?
does it assume one line for header and one line for trailer?
Please provide a sample with header, some data and trailer rows. Use the "bracket icon" to share this text or alternatively attach it as a text file.
Then based on the sample text you share explain/show the desired result (like: is the header the column names that you want to use as variable names or something else).
"bracket icon"
We need to understand if header and footer are just always the first and last line in your text file, or if there could be multiple lines of header and footer and you have some sort of a line type indicator in column one, or ... Sharing representative sample data will answer all these questions.
That would be better if you post this TEXT file and the OUTPUT you would like to see.
Anyway, here is an example:
data have;
infile "c:\temp\outfile.txt" length=len truncover;
input have $varying800. len;
run;
It all depends on how these macro variables are used later in the code. Read the documentation of the program.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.