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.

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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