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 🙂

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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