I have a long list of colors, set in GOPTIONS
goptions colors=(black red green blue cyan magenta orange lightblue limegreen purple brown yellow salmon
darkgreen pink turquoise tan olive firebrick slateblue orangered yellowgreen teal gray44 blueviolet
crimson chocolate darkmagenta gold silver peru plum powderblue tomato olivedrab lavender khaki darkgray
cornsilk deepskyblue deeppink goldenrod);
Then I try to obtain this same list of colors in a macro variable for use in the program:
%let colors=%sysfunc(getoption(colors));
and the resulting macro variable is
( BLACK RED GREEN BLUE CYAN MAGENTA ORANGE LIGHTBLU LIMEGREE PURPLE BROWN YELLOW SALMON DARKGREE PINK TURQUOIS TAN OLIVE
FIREBRIC SLATEBLU ORANGERE YELLOWGR TEAL GRAY44 BLUEVIOL CRIMSON CHOCOLAT DARKMAGE GOLD SILVER PERU PLUM POWDERBL TOMATO
OLIVEDRA LAVEN
I understand why the color names are maximum eight characters, that's fine, not a problem. I do not understand why the macro variable ends with laven (lavender) and doesn't include the remaining colors.
What is the problem here? How do I fix this?
I would say you've hit a maximum length for macro variables there $2000. Have a look in SASHELP.VGOPT dataset, you can find COLORS option there, I would expect more than one, try processing from that rather than assign to macro var.
The maximum number of characters which can be stored in a macro variable is 32767, not 2000. The limit must be down to the getoption() function.
Maybe it is a limit with GETOPTION, seems like the limit might be 256 characters
Nevertheless, I can get the information out of the SASHELP.VGOPT table
A related limit ... but not the one you are running into ... within SASHELP.VGOPT, the variable SETTING which holds the colors list is limited to 1024 characters.
VGOPT SETTINGS contains something even more bizarre when I ran it.
( BLACK RED GREEN BLUE CYAN MAGENTA ORANGE LIGHTBLU E LIMEGREE N PURPLE BROWN YELLOW SALMON DARKGREE N PINK TURQUOIS E TAN OLIVE FIREBRIC K SLATEBLU E ORANGERE D )
I'm not seeing that particular issue, data_null_;
I can only see the "correct" (truncated to 8 byte words) list with PROC GOPTIONS.
Yes i see too it like so
searching color name i have found that in the register you have colors in short for the html colors
but only for G O P green orange and purple
!!!!!!
Andre and data_null_; what version of SAS, what operating system? I am not seeing this with SAS 9.4, Windows 7 PRO 64bit
I am running 9.3 (TS1M2) on SunOS 5.10 (SUN 64).
Paige is wondering if you should report this as a bug, and see what SAS has to say ... it sure seems like a bug to me ... of course, if this is not something you would ever need in your work then you may not want to bother
Paige
My version is sas 9.3.2 Windows 7 32 bits
Andre
FYI, at least since SAS 9.2, the max length of a macro variable was bumped up to 65,534
Haikuo
You seem to have hit the limit on the COLORS option. What use do you have for so many colors? I doubt that any graph produced with so many colors would be readable by humans.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.