BookmarkSubscribeRSS Feed
LauraBona92
Calcite | Level 5

Hi

 

How should I code my probplot options in my proc univariate in order to get male/female distinct normal line ?

With my following code, I get only one normal line based on female statistics of BodyTemp.

 

 

ods graphics on/width=1000;

proc univariate data=Statdata.NormTemp;
var BodyTemp;
class Gender;
id ID; 
histogram BodyTemp / NORMAL(color=blue) overlay;
probplot BodyTemp / NORMAL (mu=est sigma=est) overlay;
inset n='number of measurements recorded' mean median std='Standard Deviation' skewness kurtosis / position=ne;
title "Assessing normality of Body temperature (in celsius) by Gender";
run;

 

 

Thanks in advance for your help.

Laura B

1 REPLY 1
sbxkoenk
SAS Super FREQ

Hello,

 

I would open a Technical Support track for this.

I notice the same (unexpected) behavior in below program (only one normal line instead of three).
I have also found this usage note , but it does not solve your problem :
       Usage Note 24299: Plotting more than one theoretical distribution on one graph
https://support.sas.com/kb/24/299.html

 

 

* If you have several variables you want to overlay, 
first reshape the data set to stack the vars and create a CLASS or indicator variable; 
data one;
  do i=1 to 25;
   a=rannor(32409);
   b=2+1.5*rannor(32409);
   c=ranuni(32409);
   output;
  end;
  drop i;
run;

* add a unique var (if you don't already have one in the data set) to use in PROC TRANSPOSE; 
data one;
  set one;
  id=_n_;
run;

proc transpose data=one out=two(rename=(_NAME_=Source Col1=Measure) drop=ID);
  by ID;
run;

ods listing close;
ods html;
ods graphics on;
proc univariate data=two noprint;
  label source=;
  class source;
  var measure;
  probplot measure/ NORMAL (mu=est sigma=est) overlay;
  qqplot   measure/ overlay;
  cdfplot  measure/ overlay;
run;
/* end of program */

 

 

Cheers,

Koen

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1 reply
  • 524 views
  • 1 like
  • 2 in conversation