-2
$\begingroup$
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;
$\endgroup$
  • 1
    $\begingroup$ Could you please ask a specific question, @bety? Otherwise this thread will have to be closed. $\endgroup$ – whuber Apr 27 '12 at 14:28
3
$\begingroup$

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

$\endgroup$
  • 1
    $\begingroup$ In addition to @ken 's answer, another method is to use a different ODS destination, such as an rtf file. $\endgroup$ – Peter Flom - Reinstate Monica Apr 27 '12 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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