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

Hi all,

I have this code:

 

proc reg data=eingabe3 plots(label)=(CooksD);
id serialno;
model sdnn_ms=age age2;
run;

 

producing the attached graphic.

I want to know how to align the labels to the data spikes. Now they are shifted to right.

Thank you.

 

Regards

Frank


Bildschirmfoto 2016-07-09 um 21.53.36.png
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Try adding:

format serialno 4.;

as the first line of the procedure.  I assume that the ID variable is numeric and has a format with a large width field (maybe 12?).

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

Try adding:

format serialno 4.;

as the first line of the procedure.  I assume that the ID variable is numeric and has a format with a large width field (maybe 12?).

sauer
Obsidian | Level 7

Hi Rick,

yes, this was the idea! I had "serialno 5." - this is quiet a difference.

Is there a chance to avoid the labels in the lower part of the diagram?

 

Thanks

Frank

Rick_SAS
SAS Super FREQ

The cutoff value is (I think) 4/n where n is the number of nonmissing obs. Points with Cook's D greater than that value are labeled. 

 

Probably the easiest way control the labeling is to output the Cook's D statistic in the OUTPUT statement and then use PROC SGPLOT to create the plot manually. 

 

ods select CooksDPlot;
proc reg data = sashelp.cars plots(label)=(CooksD);
  model mpg_city = weight wheelbase;
  output out=RegOut cookd=cookd;
quit;
%let cutoff = 0.05;  /* create new cutoff value */
data RegOut;
format MyLabel $8.;
set RegOut;
ObsNum = _N_;
if cookD > &cutoff then 
   MyLabel = Model;
else 
   MyLabel = " ";
run;

proc sgplot data=RegOut;
  needle x=ObsNum y=CookD / datalabel = MyLabel;
  refline &cutoff / axis=y;
run;
sauer
Obsidian | Level 7

Thank you very much. That works very fine Smiley Happy

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 2211 views
  • 2 likes
  • 2 in conversation