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

In a proc reg code like the following:

 

proc reg data=data1 PLOTS(MAXPOINTS=none);
model var = var2 /noint;
where var3="var5" ;
OUTPUT OUT=data2 p=yhat r=resid1 rstudent=rstud1 ucl=yhatupper lcl=yhatlower;
run;

 

How does sas calculate ucl and lcl? If I want to calculate these in Excel how can do it?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Formulas are here:
https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

I wouldn't recommend trying to calculate it manually unless you have no choice. If you need estimates for new predictions you can get those from PROC PLM or SCORE if not directly from PROC REG.

View solution in original post

7 REPLIES 7
Reeza
Super User
Formulas are here:
https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...

I wouldn't recommend trying to calculate it manually unless you have no choice. If you need estimates for new predictions you can get those from PROC PLM or SCORE if not directly from PROC REG.
SteveDenham
Jade | Level 19

I don't mean to sound snarky, but asking how to calculate something in Excel when SAS already calculates it for you is like asking how to drive a chariot when you already own a Porsche.

 

SteveDenham

adrfinance
Obsidian | Level 7

if you have to calculate it by yourself for your work then you have to try and understand it and be able to implement it in other software as well.

PaigeMiller
Diamond | Level 26

If you have SAS, why implement it in some other software? SAS has spent lots of man-hours debugging their code, and validating the code, and it has been tested in approximately 5,378,022 real-world applications, and it has also been validated by the FDA and probably others. If you write the code yourself, you aren't going to put the effort into it that SAS has put into it, and your self-written code can be more easily questioned and can be more easily incorrect.

--
Paige Miller
adrfinance
Obsidian | Level 7
just to understand how it is calculated. I am not doubting that SAS is right
SteveDenham
Jade | Level 19

Then do it by hand.  The act of putting pencil to paper will do more to make this understandable than trying to write code that already exists in so many other places.  If you need the values for future computations in Excel, then learning to export the values via ODS and a libname would be more apt to be usable.

 

SteveDenham

Reeza
Super User

@adrfinance wrote:

if you have to calculate it by yourself for your work then you have to try and understand it and be able to implement it in other software as well.


From an academic standpoint I agree, and you should especially understand the difference between a confidence interval and a prediction interval. 

You should do it at least once to understand it, that usually occurs in an introduction to linear regression math course. Regression CI are fairly standard so I wouldn't expect SAS implementation to be significantly different in any manner so using the formula's in any standard reference book is fine. 

 

Here's an R example:

https://rstudio-pubs-static.s3.amazonaws.com/195401_20b3272a8bb04615ae7ee4c81d18ffb5.html

 

 

 

 

 

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1862 views
  • 2 likes
  • 4 in conversation