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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1042 views
  • 1 like
  • 2 in conversation