BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
stephanie_h6
Calcite | Level 5

Hi all,

 

I'm trying to build a graph using different colors of markers, depending on treatments. I found this thread, with the same question that I had:

https://communities.sas.com/t5/Graphics-Programming/Proc-sgplot-plotting-different-colors-and-marker...

 

I tried what they suggested (creating an attribute map), but I always end up with multiple errors and still no graph.  

The code I use is this one:

 

data myattrmap;

input ID $ value $ markercolor $;

datalines;

Trait Lisier pink

Trait Mineral lightblue

Trait Luzerne green ;

run;

PROC GPLOT data= indiv dattrmap=myattrmap;
Title "Representation de chaque donnee axe2*axe1";
plot y*x/annotate=indiv frame href=0 vref=0 attrid= "Trait";
symbol1 v=circle ;

run;

 

My attribute map seems to be created successfully, and the problem appears when I run the proc SG plot, with the following messages:

 

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
71 PROC GPLOT data= indiv dattrmap=myattrmap;
________
22
76
ERROR 22-322: Erreur de syntaxe, l'une des valeurs suivantes est attendue : ;, (, ANNOTATE, DATA, GOUT, UNIFORM.
ERROR 76-322: Syntax error, statement will be ignored.
72 Title "Representation de chaque donnee axe2*axe1";
ERROR: No data set open to look up variables.
ERROR: No data set open to look up variables.
NOTE: l'instruction précédente a été supprimée.
73 plot y*x/annotate=indiv frame href=0 vref=0 attrid= "Trait";
______
22
76
ERROR 22-322: Erreur de syntaxe, l'une des valeurs suivantes est attendue : une constante numérique, une constante date temps, ;,
',', ANNOTATE, AREAS, AUTOHREF, AUTOVREF, CAUTOHREF, CAUTOVREF, CAXIS, CBASELINE, CFRAME, CHREF, COUTLINE, CTEXT,
CVREF, DESCRIPTION, FRAME, FRONTREF, GRID, HAXIS, HMINOR, HREF, HREVERSE, HTML, HTML_LEGEND, HZERO, IFRAME,
IMAGESTYLE, LAUTOHREF, LAUTOVREF, LEGEND, LHREF, LVREF, NAME, NOAXIS, NOFRAME, NOLASTAREA, NOLEGEND, OVERLAY, REGEQN,
SKIPMISS, TO, URL, VAXIS, VMINOR, VREF, VREVERSE, VZERO, WAUTOHREF, WAUTOVREF, WHREF, WVREF.
ERROR 76-322: Syntax error, statement will be ignored.
74 symbol1 v=circle ;
75
76 run;
 
77
78
79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

 

I am sorry as the error messages are in french, but I guess you can still see my mistakes pretty quickly.

Also, if you have another solution to reach my objective, i would gladly take it. 

 

Thanks in advance,

Stéphanie

 



1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Attribute maps only work with SAS 9.4 and SGPLOT, SGSCATTER, and SGPANEL, they are not available for the ancient and dreadful gplot system.  Drop gplot and move to a modern graphing system such as sgplot or GTL.  If you need help on that, this is the best resource out there, with example code:
http://blogs.sas.com/content/graphicallyspeaking/

 

As for your error, its probable that you don't have graph available, are you perhaps using SAS University Edition?  That doesn't have gplot for instance.  If not, have you closed and restarted SAS, then run just that bit of code as you may have errors from before holding over.  As the log goes from 1 to 70, we appear to be missing a big chunk of what could decipher this error.

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Attribute maps only work with SAS 9.4 and SGPLOT, SGSCATTER, and SGPANEL, they are not available for the ancient and dreadful gplot system.  Drop gplot and move to a modern graphing system such as sgplot or GTL.  If you need help on that, this is the best resource out there, with example code:
http://blogs.sas.com/content/graphicallyspeaking/

 

As for your error, its probable that you don't have graph available, are you perhaps using SAS University Edition?  That doesn't have gplot for instance.  If not, have you closed and restarted SAS, then run just that bit of code as you may have errors from before holding over.  As the log goes from 1 to 70, we appear to be missing a big chunk of what could decipher this error.

stephanie_h6
Calcite | Level 5

Thank you for your answer. I am indeed using Sas Studio through Sas OnDemand for Academics. 

You pointed out my mistake: i was using the gplot instead of the sgplot procedure. So I changed the "plot" for the "scatter", with the good options.

 

It worked.

Thanks

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1008 views
  • 3 likes
  • 3 in conversation