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.
Am I missing something?
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..
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..
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.
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.