BookmarkSubscribeRSS Feed
venkatnaveen
Obsidian | Level 7

Hi,

How I can read flat files without reading header and footer,suppose I have an flat files with 100pages,I wanna to read those files into my sas environment ,without reading header and footer.

7 REPLIES 7
LinusH
Tourmaline | Level 20

You mean that you file has header and footer, and you want wish to avoid those?

Header is on row 1 i guess, so just if _n_ = 1 then delete;

Footer, if yo are sure that there always is a footer, make use of the END= infile option.

And what do you mean that you have 100 pages in the file, what kind of file is it?

Data never sleeps
damanaulakh88
Obsidian | Level 7

Hi.

infile <filename> firstobs=2 will skip the first header record.

Patrick
Opal | Level 21

Is there anything in your source which identifies a header and a footer? Eg. a column "record type"?

sas-innovate-2024.png

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.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1742 views
  • 0 likes
  • 4 in conversation