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

Hello all,

 

I want to put the leverage and outlier observations that are detected via robust regression, in a separate dataset. Any help will be appreciated to solve my problem.

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

@fatemeh 

In your recent thread Detect extreme values through leverage and outlier changing cutoff value based on 90 percentiles you were recommended to read @Rick_SAS's blog post Detecting outliers in SAS: Part 3: Multivariate location and scatter

 

Take another look at the post.  It has an example that does bulk of what you request.  The statement 

   ods output diagnostics=Diagnostics(where=(leverage=1));

produced a data set named diagnostics with 4 observations at leverage=1. 

 

Instead you could drop the "where=(leverage=1)" options, which would produce as many obs in diagnostics as in your original data, and in the same order.

 

You could then do this:

data want;
   merge your_original_dataset diagnostics;
   if leverage=1;
run;

Or you could use whatever minimum leverage values you prefer.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

1 REPLY 1
mkeintz
PROC Star

@fatemeh 

In your recent thread Detect extreme values through leverage and outlier changing cutoff value based on 90 percentiles you were recommended to read @Rick_SAS's blog post Detecting outliers in SAS: Part 3: Multivariate location and scatter

 

Take another look at the post.  It has an example that does bulk of what you request.  The statement 

   ods output diagnostics=Diagnostics(where=(leverage=1));

produced a data set named diagnostics with 4 observations at leverage=1. 

 

Instead you could drop the "where=(leverage=1)" options, which would produce as many obs in diagnostics as in your original data, and in the same order.

 

You could then do this:

data want;
   merge your_original_dataset diagnostics;
   if leverage=1;
run;

Or you could use whatever minimum leverage values you prefer.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 382 views
  • 2 likes
  • 2 in conversation