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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 1164 views
  • 0 likes
  • 4 in conversation