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 🙂

sas-innovate-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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