BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nietzsche
Lapis Lazuli | Level 10

Is it possible? Cant seem to get it to work.

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@ger15xxhcker wrote:

Yes, you can use the DROP and KEEP options in PROC MEANS in SAS. Here is an example of how you can use them:

proc means data=mydata noprint;
var x y z;
drop xmean ymean zmean;
keep xstd ystd zstd;
run;


These are DROP or KEEP statements, not DROP or KEEP options. You cannot use DROP or KEEP statements in PROC MEANS. If I use:

 

proc means data=sashelp.class;
var height weight age;
drop age;
keep height;
run;

 

then the log says you can't use the DROP statements or KEEP statements:

 

 69         proc means data=sashelp.class;
 70         var height weight age;
 71         drop age;
 NOTE: The DROP and KEEP statements are not supported in procedure steps in this release of the SAS System. Therefore, these 
       statements are ignored.
 72         keep height;
 NOTE: The DROP and KEEP statements are not supported in procedure steps in this release of the SAS System. Therefore, these 
       statements are ignored.
 73         run;


What you can do is use the DROP or KEEP options.

 

proc means data=sashelp.class(drop=height);
run;

 

--
Paige Miller

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

You can use Drop / Keep Data Set Options all you want in the input / output data set. Hard to tell what is wrong without seeing your code, but I suspect you attempt to use Drop / Keep Statements. Which are not supported.

ger15xxhcker
Quartz | Level 8

Yes, you can use the DROP and KEEP options in PROC MEANS in SAS. Here is an example of how you can use them:

proc means data=mydata noprint;
var x y z;
drop xmean ymean zmean;
keep xstd ystd zstd;
run;

PaigeMiller
Diamond | Level 26

@ger15xxhcker wrote:

Yes, you can use the DROP and KEEP options in PROC MEANS in SAS. Here is an example of how you can use them:

proc means data=mydata noprint;
var x y z;
drop xmean ymean zmean;
keep xstd ystd zstd;
run;


These are DROP or KEEP statements, not DROP or KEEP options. You cannot use DROP or KEEP statements in PROC MEANS. If I use:

 

proc means data=sashelp.class;
var height weight age;
drop age;
keep height;
run;

 

then the log says you can't use the DROP statements or KEEP statements:

 

 69         proc means data=sashelp.class;
 70         var height weight age;
 71         drop age;
 NOTE: The DROP and KEEP statements are not supported in procedure steps in this release of the SAS System. Therefore, these 
       statements are ignored.
 72         keep height;
 NOTE: The DROP and KEEP statements are not supported in procedure steps in this release of the SAS System. Therefore, these 
       statements are ignored.
 73         run;


What you can do is use the DROP or KEEP options.

 

proc means data=sashelp.class(drop=height);
run;

 

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 2398 views
  • 0 likes
  • 4 in conversation