Data visualization with SAS programming

SAS University Edition and switching from GPLOT to SGPLOT

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

SAS University Edition and switching from GPLOT to SGPLOT

[ Edited ]

Hello all.

 

I just discovered that apparently all my problems are due to the fact that PROC GPLOT doesn't work on SAS UE (very useful indeed! Smiley Frustrated), and from my searches I think I cannot just switch the name of the procedure, but a different code is required to get the same output as in GPLOT.

 

How can I turn the code below in something that would give me the same result in SGPLOT as I would have got with GPLOT?

 

SYMBOL1 i=join V=* C=bib; 
SYMBOL2 i=join V=diamond C=RED; 
SYMBOL3 i=join V=star C=orange; 
SYMBOL4 i=join V=triangle C=green; 
SYMBOL5 i=join V=squarefilled C=yellow;

I'm especially interested in the colors and in the right code to have the data points joined.

 

Can anyone help me?


Accepted Solutions
Solution
‎11-04-2017 11:55 AM
SAS Super FREQ
Posts: 8,885

Re: SAS University Edition and switching from GPLOT to SGPLOT

Posted in reply to LunaMinerva

Hi:

  Try this code:

data testdata;
  infile datalines;
  input Product Date : date. Actual Predict;
  format Date monyy5.;
return;
datalines;
AAA 01JAN17 3723 3513 
AAA 01FEB17 2317 2664 
AAA 01MAR17 2799 3098 
AAA 01APR17 2286 1087 
AAA 01MAY17 3031 2033 
AAA 01JUN17 1955 1913
;
run; 

title; footnote;

proc sgplot data=testdata;  
series x=Date y=Actual/markers lineattrs=(color=red)
                     markerattrs=(color=red symbol=StarFilled);
series x=Date y=Predict / markers lineattrs=(color=blue)
                      markerattrs=(color=blue symbol=DiamondFilled);
format Date monyy5.;
xaxis discreteorder=data values=('01jan2017'd to '01jun2017'd by month);
run;

When you use the SG procedures, such as SGPLOT, you do not need to have SYMBOL statements, instead, you use options inside the procedure to control how the procedure works.

 

There are a lot of good SGPLOT examples in the documentation and in this blog: http://support.sas.com/rnd/datavisualization/graphicallyspeakingindex/

 

cynthia

 

View solution in original post


All Replies
Solution
‎11-04-2017 11:55 AM
SAS Super FREQ
Posts: 8,885

Re: SAS University Edition and switching from GPLOT to SGPLOT

Posted in reply to LunaMinerva

Hi:

  Try this code:

data testdata;
  infile datalines;
  input Product Date : date. Actual Predict;
  format Date monyy5.;
return;
datalines;
AAA 01JAN17 3723 3513 
AAA 01FEB17 2317 2664 
AAA 01MAR17 2799 3098 
AAA 01APR17 2286 1087 
AAA 01MAY17 3031 2033 
AAA 01JUN17 1955 1913
;
run; 

title; footnote;

proc sgplot data=testdata;  
series x=Date y=Actual/markers lineattrs=(color=red)
                     markerattrs=(color=red symbol=StarFilled);
series x=Date y=Predict / markers lineattrs=(color=blue)
                      markerattrs=(color=blue symbol=DiamondFilled);
format Date monyy5.;
xaxis discreteorder=data values=('01jan2017'd to '01jun2017'd by month);
run;

When you use the SG procedures, such as SGPLOT, you do not need to have SYMBOL statements, instead, you use options inside the procedure to control how the procedure works.

 

There are a lot of good SGPLOT examples in the documentation and in this blog: http://support.sas.com/rnd/datavisualization/graphicallyspeakingindex/

 

cynthia

 

Super User
Posts: 20,203

Re: SAS University Edition and switching from GPLOT to SGPLOT

Posted in reply to LunaMinerva

Even if GPLOT works, SG is a better approach because you have more control and it's better quality graphics. 

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 150 views
  • 2 likes
  • 3 in conversation