DATA Step, Macro, Functions and more

RETURN VALUE OPTIONS for GETOPITON

Accepted Solution Solved
Reply
Contributor FK1
Contributor
Posts: 40
Accepted Solution

RETURN VALUE OPTIONS for GETOPITON

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?

 


Accepted Solutions
Solution
‎01-11-2018 06:36 AM
Super User
Posts: 6,931

Re: RETURN VALUE OPTIONS for GETOPITON

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


All Replies
Solution
‎01-11-2018 06:36 AM
Super User
Posts: 6,931

Re: RETURN VALUE OPTIONS for GETOPITON

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

Contributor FK1
Contributor
Posts: 40

Re: RETURN VALUE OPTIONS for GETOPITON

Posted in reply to Astounding
Sometimes the easiest things are the ones that cause trouble :-)
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 101 views
  • 0 likes
  • 2 in conversation