Data visualization with SAS programming

Graph with sas for University

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

Graph with sas for University

I intend to run a program with SAS for University . The problem is that i have some plot  with Proc Glopt. I know that this procedure is not available in that version. Is there any way of do that??  I attach a program


Accepted Solutions
Solution
‎11-17-2015 01:07 PM
Occasional Contributor
Posts: 16

Re: Graph with sas for University

Thanks Dan.
your answer was very helpful. I try to run it with these modifications. I'll let you know if i have some trouble.
 This is de data set    I used to generate the plots.

thanks again

 

data sal;

input m q11 q12 q21 q22 ;

datalines;

3209.07 2.24409 3.07872 1.53264 1.81912

;

 

DATA _null_ ;SET Sal;

CALL SYMPUT('dms',dms) ;

CALL SYMPUT('MEDIA',M) ;

CALL SYMPUT ('FV5',Q11);CALL SYMPUT ('FV10',Q12 ); CALL SYMPUT ( 'F5',Q21 ); CALL SYMPUT( 'F10',Q22);

Data labels;

   set STAB;

   retain xsys '2' ysys '2';

length function text $13 ;

   text = cult ;

 

         color='black ';

         size = 0.9;

         style = 'SWISSB';

         x = FV;

         y = MV;

         position='10';

         function = 'LABEL';

         output;

 

View solution in original post


All Replies
Grand Advisor
Posts: 10,206

Re: Graph with sas for University

Proc SGPLOT with a Scatter plot looks like what you may want. Annotate works a bit differently with the SG procedures so you'll need to look that up.

SGPLOT does not use the AXISn or Symboln statements. Axis controls are with the Xaxis and Yaxis statements and the symbols by default come from the current active style.

 

This site http://support.sas.com/sassamples/graphgallery/PROC_SGPLOT.html has some examples you can look at.

Occasional Contributor
Posts: 16

Re: Graph with sas for University

Thanks a lot for your help
Occasional Contributor
Posts: 16

Re: Graph with sas for University

I was able to do the graphics correctly with some  modifications. I wander if it is possible to convert this kind of graph (biplot) with sgplot or other procedure.

thanks again and your  suggestions were very useful

SAS Super FREQ
Posts: 889

Re: Graph with sas for University

Sure. Just use two SCATTER plots, one for each pair. They will automatically overlay.

SAS Super FREQ
Posts: 889

Re: Graph with sas for University

You will need to convert your PROC GPLOTs to PROC SGPLOTs. To give you a feel for it, I've taken your first GPLOT call and made a "rough" conversion to SGPLOT ( I cannot run it because all of the data is not there).

 

Hope this helps!

Dan

 

/* SGPLOT code */

 

PROC SGPLOT data=STAB noautolegend;

scatter y=MV x=FV / markerattrs=(color=black) datalabel=cult;

refline &FV5 &FV10 / lineattrs=(color=black pattern=3);

refline &MEDIA / axis=x lineattrs=(color=black pattern=3);

run;

 

 

Proc gplot data=STAB;

Plot MV*FV / Annotate=labels frame

Vref=&MEDIA Href =&FV5 &FV10

cvref=black chref=black

lvref=3 lhref=3

vaxis=axis2 haxis=axis1

vminor=1 hminor=1 nolegend;

 

symbol1 v=none c=black h=0.7 ;

symbol2 v=none c=blue i=j line=3 ;

 

axis2

length =3.0 in order=(1800 to 3600 by 200)

label=(f=SWISSB h=1.0 a=90 r=0 'RENDIMIENTO')

value=(h=1)

minor=none;

 

axis1

length =5.0 in

label=(f=SWISSB h=1.0 'TEST DE ESTABILIDAD')

value=(h=1) order=(0 to 7)

minor=none;

 

*Title1 f=SWISSB h=1.0 'AMMI biplot ';

 

run;

quit;

 

 

Solution
‎11-17-2015 01:07 PM
Occasional Contributor
Posts: 16

Re: Graph with sas for University

Thanks Dan.
your answer was very helpful. I try to run it with these modifications. I'll let you know if i have some trouble.
 This is de data set    I used to generate the plots.

thanks again

 

data sal;

input m q11 q12 q21 q22 ;

datalines;

3209.07 2.24409 3.07872 1.53264 1.81912

;

 

DATA _null_ ;SET Sal;

CALL SYMPUT('dms',dms) ;

CALL SYMPUT('MEDIA',M) ;

CALL SYMPUT ('FV5',Q11);CALL SYMPUT ('FV10',Q12 ); CALL SYMPUT ( 'F5',Q21 ); CALL SYMPUT( 'F10',Q22);

Data labels;

   set STAB;

   retain xsys '2' ysys '2';

length function text $13 ;

   text = cult ;

 

         color='black ';

         size = 0.9;

         style = 'SWISSB';

         x = FV;

         y = MV;

         position='10';

         function = 'LABEL';

         output;

 

SAS Super FREQ
Posts: 889

Re: Graph with sas for University

In the LABELS data step, there was a reference to a data set called STAB that I could not find. However, I do not think you will need that data set anyway, as the DATALABEL option can point directly to the "cult" column, and you can use DATALABELATTRS to modify the appearance of the text.

 

Thanks!
Dan

Occasional Contributor
Posts: 16

Re: Graph with sas for University

Thank a lot
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 740 views
  • 0 likes
  • 3 in conversation