Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.
data a;
input treat$    rep boreria mimiosa asysta  axono   seleria paspa   macran  melas   scopo   cleom   otto;
cards;
M   1   0.20    0.00    0.00    0.00    0.00    12.20   0.00    0.00    0.00    4.90    0.00
M   2   0.00    0.00    0.00    0.64    0.00    0.00    0.00    0.00    0.00    0.00    0.00
M   3   0.00    0.00    0.00    0.23    0.00    0.00    0.32    0.00    0.00    0.00    0.00
A   1   0.00    0.00    7.80    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
A   2   0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
A   3   0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
CA  1   9.40    1.24    1.59    5.20    0.00    1.77    0.00    0.00    0.12    0.00    0.00
CA  2   0.75    0.00    0.00    2.10    0.00    0.00    0.00    0.00    0.00    0.00    2.66
CA  3   2.00    0.99    0.00    1.10    0.00    0.00    0.00    0.76    0.00    0.00    0.00
P   1   0.00    0.00    0.00    1.56    0.97    0.00    0.00    0.10    0.00    0.00    0.00
P   2   0.02    0.00    0.00    0.93    0.00    3.50    0.00    0.00    0.00    0.00    0.00
P   3   0.00    0.00    0.00    0.00    0.00    6.20    1.00    0.00    0.00    0.00    0.00
W   1   13.40   15.80   0.30    104.50  0.00    127.70  0.00    0.00    0.00    0.00    0.00
W   2   4.80    0.00    0.64    121.10  41.10   58.10   0.00    9.20    0.00    0.00    0.59
W   3   0.00    0.00    0.00    53.00   0.00    54.70   0.00    10.10   0.00    0.00    0.00
;
data b;
set a;
array log{*} boreria--otto;
do i = 1 to dim(log);
log(i)=log10(log(i)+1);
end;
output;
drop i;
run;
ods output  Eigenvectors=vector ;
proc princomp out=pcacomp  ;
    VAR boreria--otto;
RUN;

data vec;
set vector (rename = (variable=Weed prin1=vec1 prin2=vec2));
vec1 = vec1*7;
vec2 = vec2*7;
drop prin3-prin10;
run;

data new;
merge pcacomp vec;
run;



ods listing style=statistical image_dpi=300;
proc sgplot data=new;
VECTOR x=vec1 y=vec2/group=weed ARROWHEADSHAPE=filled DATALABEL=weed;
scatter x=prin1 y=prin2 / group=treat name='site';
ellipse x=prin1 y=prin2 / LINEATTRS=(pattern=2) TRANSPARENCY=0.1 ; 
refline 0 /axis=x LINEATTRS=(PATTERN=1);
refline 0 /axis=y LINEATTRS=(PATTERN=1);
xaxis label='PCA1 (32.0%)' grid ;
yaxis label='PCA2 (18.2%)' grid;
KEYLEGEND 'site' /title='Treatment' LOCATION= inside position= topLEFT across=3 noborder; 
run;
share|improve this question
1  
Could you please ask a specific question, @bety? Otherwise this thread will have to be closed. – whuber Apr 27 '12 at 14:28

1 Answer

I just ran your code and it all works fine on my computer.

In SAS 9.2, check the Results/Explorer window and go to Results tab (the bottom of that window) and my guess is, it should created a PNG file of the plot from PROC SGPLOT.

Based on my experience, you cannot open high-resolution graphical outputs in SAS 9.2, but SAS Enterprise Guide can.

enter image description here

share|improve this answer
1  
In addition to @ken 's answer, another method is to use a different ODS destination, such as an rtf file. – Peter Flom Apr 27 '12 at 16:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.