data work.cleandata36;
set cert.input36;
group=upcase(group);
if upcase(group) in ('A','B');
run;
proc means data=work.cleandata36 median;
class group;
var kilograms;
run;
data results.output36;
set cleandata36;
if Kilograms < 40 or Kilograms > 200 then do;
if group='A' then kilograms=79;
else kilograms=89;
end;
run;
proc print data = results.output36;
run;
proc means data=results.output36 mean;
class group;
var kilograms;
run;
output is following:
why the third is 'Median' , it would be 'Mean' , because I use Mean option in the code ?
Your first PROC MEANS specifically asks for MEDIAN.
oh, I see , but , why there isn't a output for the 'proc mean data = results.output36 mean' ?
473
474 proc means data=work.cleandata36 median;
475 class group;
476 var kilograms;
477 run;
NOTE: There were 4992 observations read from the data set WORK.CLEANDATA36.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
478 data results.output36;
479 set work.cleandata36;
480 if Kilograms < 40 or Kilograms > 200 then do;
481 if group='A' then kilograms=79;
482 else kilograms=89;
483 end;
484 run;
ERROR: Libref RESULTS is not assigned.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
485 proc means data=results.output36 mean;
ERROR: Libref RESULTS is not assigned.
486 class group;
ERROR: No data set open to look up variables.
487 var kilograms;
ERROR: No data set open to look up variables.
488 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Now it works well . Thank you for your help .
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.