In the INFILE statement, use the end= option to define a flag variable; use this flag variable to not output the last line:
data _null_;
infile '/home/fkhurshed/Demo1/demo.txt.sas' end=done;
file "&work_path./temp.txt";
input ;
if _n_ < 4 or done then delete;
else put _infile_;
run;
Since you opted to using proc import, you don't have many ways to customise the way you read the file.
Your last row will have to be deleted manually, if proc import includes it.
data WANT;
set WANT end=LASTOBS;
if LASTOBS then delete;
run;
When using the infile statement, there are many options, such as the one showed by @Kurt_Bremser .
It can be accomplished now with my task of importing .TXT files with head lines and tail lines.
Thanks for everyone's help!
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.