Statistical Procedures

Programming the statistical procedures from SAS
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-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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