BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tebert
Obsidian | Level 7

How do I generate a new varaible in my dataset that has the quanitles of the normal distribution such that when I graph the new variable and the residuals I would get the equivalent of the qqplot statement in proc Univariate?

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

You can use the Quantile Function to compute quantiles of the Normal Distribution like this

 

data NormQuantiles;
    do x=.025 to .975 by .025;
        q=quantile('Normal', x, 0, 1);
        output;
    end;
run;

Regarding replicating a qqplot, please specify what model you run. Makes it easier to help you

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

You can use the Quantile Function to compute quantiles of the Normal Distribution like this

 

data NormQuantiles;
    do x=.025 to .975 by .025;
        q=quantile('Normal', x, 0, 1);
        output;
    end;
run;

Regarding replicating a qqplot, please specify what model you run. Makes it easier to help you

tebert
Obsidian | Level 7

I think you gave me the answer that I need. All I would need to do is to replace the number in  "by .025" in your example with 1/n where n is the number of observations in my dataset.

 

In response to your question:

I can get a qq plot in proc glm

.

proc glm plots=diagnostics;

    model a=b c;

run;

 

I can also use Proc Univariate.

proc glm;
   model a=b c;
   output out=data2 r=resid;
run;
proc univariate;
   var resid;
   qqplot resid;
run;

 

The plot is not exactly equivalent as the diagnostic plot in Proc GLM has a line to indicate a normal distribution.

The goal is not to generate a qq plot. The qq plot from proc glm shows a clear break point where the slope of the plotted residuals changes. There is a possible biological explanation for this where light levels are insufficient to maintain C4 photosynthesis. I need to identify that break point in the data to see if that explanation works or not.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 2 replies
  • 3326 views
  • 1 like
  • 2 in conversation