BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

Hi All,

 

whenn I run this code, it works fine:

 

proc optsave out= work.default_options;
run;

data _null_;
set work.default_options;
call symputx(compress("optname"||_N_) , compress(optname));
run;

%MACRO do_it;

data append_set  ;
length optionsname optionswert  $100.;
%DO i=1 %TO   &anz_opts. ;
optionsname = "&&optname&i..";
optionswert = getoption("&&optname&i..");
output;
%END;
run;

%mend;
%do_it;

However, when I specify a return value option (e.g.: "defaultvalue") as a second argument in the getopiton function:

proc optsave out= work.default_options;
run;

data _null_;
set work.default_options;
call symputx(compress("optname"||_N_) , compress(optname));
run;

%MACRO do_it;

data append_set  ;
length optionsname optionswert  $100.;
%DO i=1 %TO   &anz_opts. ;
optionsname = "&&optname&i..";
optionswert = getoption("&&optname&i.." ,DEFAULTVALUE );
output;
%END;
run;

%mend;
%do_it;

I get a note stating that "Variable DEFAULTVALUE is uninitialized."

As far as I understand the help documentation on "getoption" it should be possible to add a second argument to the function.

 

http://support.sas.com/documentation/cdl/en/lesysoptsref/64892/HTML/default/viewer.htm#n096vc8shtf7m...

 

Am I missing something?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Have you tried putting quotes around DEFAULTVALUE?

 

I can't test it myself for a few hours,but that's often how a DATA step determines that a word is not a variable name..

View solution in original post

2 REPLIES 2
Astounding
PROC Star

Have you tried putting quotes around DEFAULTVALUE?

 

I can't test it myself for a few hours,but that's often how a DATA step determines that a word is not a variable name..

FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10
Sometimes the easiest things are the ones that cause trouble 🙂

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
  • 2 replies
  • 644 views
  • 0 likes
  • 2 in conversation