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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1826 views
  • 2 likes
  • 2 in conversation