Is it possible? Cant seem to get it to work.
@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;
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.
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;
@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;
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!
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.