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..
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.