BookmarkSubscribeRSS Feed
sasstatstudent
Calcite | Level 5

Hello, I'm having trouble figuring out how to reduce my PROC REG procedure dataset table to only contain jackknife residuals greater than 2. Here is my my code (libname removed for privacy) and my dataset table output, saved as a PDF file, since the table was too big to post here (500 observations). Thanks in Advance!

data assignm2p1;
set shr.eclsksub;
run;
proc reg data=assignm2p1;
model c1rgscal= c1r4rscl c1r4mscl / r influence vif;
output out=assignm2p1 rstudent=jackknife h=leverage cookd=influence;
run;
quit;
proc print data=assignm2p1;
where (abs(jackknife)>2);
var jackknife leverage influence ;
run;

  

3 REPLIES 3
Reeza
Super User

@sasstatstudent wrote:

Hello, I'm having trouble figuring out how to reduce my PROC REG procedure dataset table to only contain jackknife residuals greater than 2. Here is my my code (libname removed for privacy) and my dataset table output, saved as a PDF file, since the table was too big to post here (500 observations). Thanks in Advance!

data assignm2p1;
set shr.eclsksub;
run;
proc reg data=assignm2p1;
model c1rgscal= c1r4rscl c1r4mscl / r influence vif;
output out=assignm2p1 rstudent=jackknife h=leverage cookd=influence;
run;
quit;
proc print data=assignm2p1;
where (abs(jackknife)>2);
var jackknife leverage influence ;
run;

  


1. You gave the output data set the same name as your input data set. You have replaced the data set now, which is a bad idea. Give it a different name. 

2. You do filter the data set in the PRINT, so that seems to work correctly. 

 

If you want the output data set filtered you can add that WHERE statement directly to the OUTPUT statement as well.

 

proc reg data=assignm2p1;
model c1rgscal= c1r4rscl c1r4mscl / r influence vif;
output out=residuals (where=(abs(jackknife)>2) rstudent=jackknife h=leverage cookd=influence;
run;
quit;

proc print data=residuals;
run;

Some good guides on how to control ODS output:

https://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

https://blogs.sas.com/content/iml/2018/11/19/select-ods-tables-wildcards-regular-expressions-sas.htm...

https://blogs.sas.com/content/iml/2013/04/08/pointcounterpoint-ods-select.html

 

 

sasstatstudent
Calcite | Level 5

Thanks for the tip. I copied and pasted your edit onto my code. Unfortunately it didn't work, as it gave me the Errors shown below (In the meantime, I'll look at the webpages you linked in your reply):

 

Screen Shot 2022-02-02 at 8.30.06 PM.png

Reeza
Super User

The log told you what was wrong twice, MIssing ')' and Expecting a ) in red.

Add an extra bracket. 

 

Obviously without your data I can't test the code. 

 


@sasstatstudent wrote:

Thanks for the tip. I copied and pasted your edit onto my code. Unfortunately it didn't work, as it gave me the Errors shown below (In the meantime, I'll look at the webpages you linked in your reply):

 

Screen Shot 2022-02-02 at 8.30.06 PM.png


 

 

 

 

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
  • 3 replies
  • 1125 views
  • 2 likes
  • 2 in conversation