BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I am new to SAS and have a question for all the SAS guru's out there. I am trying to delete the header and trailer record
of a data file in sas and then continue with some other audits on that file. The header, the first record of the file is listed as Header90900.. and the trailer, the last record is listed as Trailer9900.



Can you please suggest the different ways how I could delete these in SAS ?



Example of file:


Header90900

565 ff dfdd dfdd 878

898 rtr sds sss 0909

....

...

Trailer9900





Note: The header and trailer have random numbers after them but they begin with the key words Header and Trailer.
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Within the DATA step execution process, you can use the INFILE parameter END= keyword to detect end-of-file (last record encountered). As well, for the initial pass of a DATA step execution, one technique is to use a RETAIN statement to set your own variable with a default value of 1 and then reset it to a zero. So, for each of these conditions, you would use a RETURN, DELETE or do not issue an OUTPUT or PUT _INFILE_, depending on your particular SAS program execution requirements.

The SAS support http://support.sas.com/ website has SAS-host documentation and also supplemental technical / conference topic papers -- you can either use the website SEARCH facility or here is a Google advanced search argument to locate some pertinent reference material on this topic:

sas data step programming site:sas.com

Scott Barry
SBBWorks, Inc.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2525 views
  • 0 likes
  • 2 in conversation