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..
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.
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.