BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
CBF
Calcite | Level 5 CBF
Calcite | Level 5
I want to produce a scree plot that I can easily paste into a word document that has an x-axis with only 15 factors. I have tried multiple methods to do this. When I tried ODS RTF, the files were blank. I finally settled on using ODS HTML, but I have not been able to adjust the x-axis on my plot. I tried using a template, but I don't think it is being applied in PROC FACTOR. I tried using SGRENDER, but the images were blank. When I do produce an image, with the code below, the x-axis shows 60 factors, so it is difficult to see where the elbow is. Any help would be greatly appreciated!

PROC TEMPLATE; 
DEFINE STATGRAPH SCREEPLOT; 
NOTES "SCREE PLOT FOR EXTRACTED EIGENVALUES";
BEGINGRAPH / DESIGNWIDTH=DEFAULTDESIGNHEIGHT; 
ENTRYTITLE "EIGENVALUE ((*ESC*){UNICODE LAMBDA}) PLOT"; 
LAYOUT OVERLAY / YAXISOPTS=(LABEL="(*ESC*){UNICODE LAMBDA}") 
XAXISOPTS=(LABEL="FACTOR NUMBER" 
LINEAROPTS=(TICKVALUELIST=(1 2 3 4 5 6 7 8 9 10))); 
SERIESPLOT Y=EIGENVALUE X=NUMBER / DISPLAY=ALL; 
ENDLAYOUT; ENDGRAPH; END; RUN;
 
ODS GRAPHICS ON ; 
%LET OUTDIR=[PATH] ;
ODS HTML PATH="&OUTDIR" (URL=NONE)
BODY='BODY2.HTML' 
/*CONTENTS='CONTENTS2.HTML'
FRAME='FRAME2.HTML' */ ;
PROC FACTOR DATA = DATA METHOD=PRINCIPAL PRIORS=SMC RESIDUAL  
ROTATE=VARIMAX OUTSTAT=OUTSTAT 
PLOTS(UNPACK)=SCREE REORDER  ;
  VAR &VARS ; 
RUN; 
ODS HTML CLOSE ;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

You could save these data firstly ,afterwards polt it by PROC SGPLOT.

ods select none;
ods output ScreePlot=ScreePlot;
PROC FACTOR DATA = sashelp.heart METHOD=PRINCIPAL PRIORS=SMC RESIDUAL  
ROTATE=VARIMAX OUTSTAT=OUTSTAT 
PLOTS(UNPACK)=SCREE REORDER  ;
  VAR _numeric_ ; 
RUN; 
ods select all;


%let n=6;  /*the number of factors you want to display*/
proc sgplot data=ScreePlot(where=(number<=&n.));
series x=number y=Eigenvalue/markers;
run;

Ksharp_0-1712284711376.png

 

Or you could check the next graph "the explained variance"  to find elbow point ?

Ksharp_1-1712284861249.png

 

 

View solution in original post

3 REPLIES 3
ballardw
Super User

Did you look at the Proc Factor option NPLOTS= to limit the number of factors plotted?

Ksharp
Super User

You could save these data firstly ,afterwards polt it by PROC SGPLOT.

ods select none;
ods output ScreePlot=ScreePlot;
PROC FACTOR DATA = sashelp.heart METHOD=PRINCIPAL PRIORS=SMC RESIDUAL  
ROTATE=VARIMAX OUTSTAT=OUTSTAT 
PLOTS(UNPACK)=SCREE REORDER  ;
  VAR _numeric_ ; 
RUN; 
ods select all;


%let n=6;  /*the number of factors you want to display*/
proc sgplot data=ScreePlot(where=(number<=&n.));
series x=number y=Eigenvalue/markers;
run;

Ksharp_0-1712284711376.png

 

Or you could check the next graph "the explained variance"  to find elbow point ?

Ksharp_1-1712284861249.png

 

 

CBF
Calcite | Level 5 CBF
Calcite | Level 5

This worked! Thank you!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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