BookmarkSubscribeRSS Feed
PaigeMiller
Diamond | Level 26

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?

--
Paige Miller
18 REPLIES 18
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

chrisj75
Calcite | Level 5

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.

PaigeMiller
Diamond | Level 26

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

--
Paige Miller
Astounding
PROC Star

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. 

data_null__
Jade | Level 19

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 )

PaigeMiller
Diamond | Level 26

I'm not seeing that particular issue, data_null_;

--
Paige Miller
data_null__
Jade | Level 19

I can only see the "correct" (truncated to 8 byte words) list with PROC GOPTIONS.

19         proc goptions option=colors;
20            run;

                                            
SAS/GRAPH software options and parameters
                                            (executing in IOM ROOT COMP ENV environment)

COLORS=( 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
LAVENDER KHAKI DARKGRAY CORNSILK DEEPSKYB DEEPPINK GOLDENRO )
                             Default color list
Andre
Obsidian | Level 7

Yes i see too it like so

aw2014-03-11_154921.png

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 purpleaw2014-03-11_154851.png

!!!!!!

PaigeMiller
Diamond | Level 26

Andre and data_null_; what version of SAS, what operating system? I am not seeing this with SAS 9.4, Windows 7 PRO 64bit

--
Paige Miller
data_null__
Jade | Level 19

I am running 9.3 (TS1M2) on SunOS 5.10 (SUN 64).

PaigeMiller
Diamond | Level 26

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 Miller
Andre
Obsidian | Level 7

Paige

My version is sas 9.3.2 Windows 7 32 bits

Andre

Haikuo
Onyx | Level 15

FYI, at least since SAS 9.2, the max length of a macro variable was bumped up to 65,534

Haikuo

Tom
Super User Tom
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 1750 views
  • 3 likes
  • 8 in conversation