I get this error when attempting to create and use an attribute map in PROC SGPANEL
ERROR 772-580: Syntax error: expecting a constant or a dynamic. Any assistance would be appreciated.
Here's my code:
data attrmap;
id="moy";
markercolor="black";
input value $ markersymbol $;
datalines;
JAN Circle
FEB Diamond
MAR Hash
APR Plus
MAY Square
JUN Star
JUL Triangle
AUG TriangleDown
SEP CircleFilled
OCT DiamondFilled
NOV SquareFilled
DEC StarFilled
;
run;
ods graphics / attrpriority=none;
proc sgpanel data=two dattrmap=attrmap;
panelby site/columns=3;
scatter x=tn y=lnvi/group=mo attrid=moy;
run;
Your variables are getting truncated in the ATTRMAP. Make sure the length is long enough.
Your variables are getting truncated in the ATTRMAP. Make sure the length is long enough.
If you do not define the length of a character variable with an informat, length or attrib statement prior to input the default length will be 8 characters. So your markersymbol values are only 8 characters long and cannot hold some of the text specified.
See
data work.attrmap; id="moy"; markercolor="black"; length markersymbol $ 15; input value $ markersymbol $; datalines; JAN Circle FEB Diamond MAR Hash APR Plus MAY Square JUN Star JUL Triangle AUG TriangleDown SEP CircleFilled OCT DiamondFilled NOV SquareFilled DEC StarFilled ; run;
Thank you both. Of course that's the correct answer. I didn't realize that SAS still restricts character lengths to 8.
SAS does not restrict the length of character variables to 8 characters. However, in some cases that is the default length. In other cases the default might be as large as 32K. For many variables, neither is desirable, so you should set your length to something more appropriate for your problem.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.