🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Pyrite | Level 9

## where is wrong

``````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 ？

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: where is wrong

So now you can see why it didn't display anything. You forgot to assign your RESULTS library.
7 REPLIES 7
Diamond | Level 26

## Re: where is wrong

Your first PROC MEANS specifically asks for MEDIAN.

--
Paige Miller
Pyrite | Level 9

## Re: where is wrong

oh, I see , but , why there isn't a output for the 'proc mean data = results.output36 mean' ?

Super User

## Re: where is wrong

Show us the full log from that section of code.
Pyrite | Level 9

## Re: where is wrong

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

Super User

## Re: where is wrong

So now you can see why it didn't display anything. You forgot to assign your RESULTS library.
Pyrite | Level 9

## Re: where is wrong

Now it works well .  Thank you for your help .

Pyrite | Level 9

## Re: where is wrong

Thank you for your help.
Discussion stats
• 7 replies
• 671 views
• 0 likes
• 3 in conversation