BookmarkSubscribeRSS Feed
PaigeMiller
Diamond | Level 26

No, I haven't hit the limit on the COLORS option, but I appear to have hit the limit on the GETOPTION command

I agree that humans have trouble distinguishing all those different colors, but tell that to the managers who want this ... what started out as a graph with 5 colors for five different pieces of equipment turns into ... "can't you do the same thing for a situation where we have 32 different operators?" ... and my version of SAS PROC ARGUEWITHMANAGERS doesn't work

--
Paige Miller
Tom
Super User Tom
Super User

Sounds like you will need to make a coding change if it is important to have access to the list of colors.

Put it into a macro variable before setting the option. Then you can just reference the macro variable.

%let colors=red blue green;

options colors=(&colors);

PaigeMiller
Diamond | Level 26

Oh no that doesn't work

I have lots of programs that call lots of utility macros that do graphs and stuff.

The utility macros have to be able to access the specific colors chosen by the calling program. Accessing the SASHELP.VGOPT seems to work for me. GETOPTION does not.

--
Paige Miller
Tom
Super User Tom
Super User

Watch out if the length gets longer than 1024.  If you are using SAS 9.4 then there will be multiple records in SASHELP.VGOPT.  It is tricky to get them concatenated correctly into a macro variable because of how SAS treats trailing blanks. In earlier versions of SAS you are limited to 1024 characters.  Even 9.4 has problems, the OFFSET variable is missing for all rows.

Here is a little program to test putting over 1500 characters into the COLORS option and seeing if they call can be retrieved.

%let str=%sysfunc(repeat(red.blue.green.,100));

%let str=%sysfunc(translate(&str,%str( ),.));

goptions colors=(&str);

data _null_;

  length value $32767;

  do i=1 by 1024 until (last.optname);

    set sashelp.vgopt end=eof;

    where optname='COLORS';

    by optname ;

    substr(value,i)=setting;

  end;

  call symputx(optname,value);

run;


%put Expected length = %length(( &str ));

%put Actual length   = %length(%superq(colors));

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1833 views
  • 3 likes
  • 8 in conversation