BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9
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:

tianerhu_0-1620749701857.png

why the third is 'Median' , it would be 'Mean'  , because I use Mean option in the code ?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
So now you can see why it didn't display anything. You forgot to assign your RESULTS library.

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Your first PROC MEANS specifically asks for MEDIAN.

--
Paige Miller
tianerhu
Pyrite | Level 9

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

Reeza
Super User
Show us the full log from that section of code.
tianerhu
Pyrite | Level 9

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

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

Now it works well .  Thank you for your help .

tianerhu
Pyrite | Level 9
Thank you for your help.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 675 views
  • 0 likes
  • 3 in conversation