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

Dear all,

 

I would like some help with the use of  supplementary variables in a PCA.

I have 10 variables (A1-A5 and B1-B5 ) that organise neatly into two factors. I would then like to plot on the graph representing the two factors, a third variable.

In fact, I. have two separate variables. One (CATEGORY) is dichotomous, with values A or B. The second one (NAME) is nested within the previous ones and has values LIT1-LIT50 and POP1-POP50.

 

I include the data file.

 

An example of what i would like appears in the graph below.

 

Many thanks in advance for any suggestion you may have.

 

 

 

Screenshot 2021-03-10 at 19.58.40.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Simply concatenate your labels?

 

data temp;
set sasforum.export;
length label $12;
label = catx("-", category, name);
run;
proc princomp data=temp n=2 out=graph plots=score(ncomp=2);
var a1-a5 b1-b5;
id label;
run;

PGStats_0-1615406284853.png

or use the out=graph dataset (which contains new variables Prin1 and Prin2) to create a fancier graph with proc sgplot.

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Simply concatenate your labels?

 

data temp;
set sasforum.export;
length label $12;
label = catx("-", category, name);
run;
proc princomp data=temp n=2 out=graph plots=score(ncomp=2);
var a1-a5 b1-b5;
id label;
run;

PGStats_0-1615406284853.png

or use the out=graph dataset (which contains new variables Prin1 and Prin2) to create a fancier graph with proc sgplot.

PG
emaneman
Pyrite | Level 9

That is perfect! And using sgplot indeed gives me a chance to make a better graph.

Thank you very much, really appreciated.

Eman

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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