BookmarkSubscribeRSS Feed
rinugour
Fluorite | Level 6

How can you limit the variables written to output dataset in DATA STEP?

3 REPLIES 3
Oligolas
Barite | Level 11

Hi,

 

you can use the DROP or KEEP statements

________________________

- Cheers -

Amir
PROC Star

Hi,

 

As well as the keep and drop statements answer already given by @Oligolas there are also keep= and drop= data set options.

 

For syntax details and an example, see the documentation:

 

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000131144.htm

 

 

Regards,

Amir.

anjita
Fluorite | Level 6

Both DROP and KEEP can be used to limit the variables in the dataset.

  • The DROP=option tells SAS which variables you want to  If you place the DROP= option on the SET statement, SAS drops the specified variables when it reads the input data set and if you place the DROP= option on the DATA statement, SAS drops the specified variables when it writes to the output data set.
  • The KEEP=option tells SAS which variables you want to  If you place the KEEP= option on the SET statement, SAS keeps the listed variables when it reads the input data set. On the other hand, if you place the KEEP= option on the DATA statement, SAS keeps the specified variables when it writes to the output data set. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

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
  • 3 replies
  • 1244 views
  • 0 likes
  • 4 in conversation