Date: Fri, 9 Apr 2004 13:26:50 -0400
Reply-To: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject: Re: holding missing option
Content-Type: text/plain; charset="us-ascii"
I have noticed this in formdlm, too.
a suggestion would be to write a sub-routine
that would read the values from Dictionary.options
and when the option is blank return the quoted space
I believe something like
select case when Value eq ' ' then ' ' else Value end
into :List
from Dictionary.options
Ron Fehd the SQL into:macro maven CDC Atlanta GA USA RJF2@cdc.gov
Bureaucracy at its worst is better than bureaucracy at its best
-- Plato, in Beetle Bailey comic strip, 1985Mar01
> -----Original Message-----
> From: Quentin McMullen [mailto:quentin_mcmullen@BROWN.EDU]
> As Peter Crawford and others have shown, %sysfunc(getoption([option],
> keyword)) is often handy in macro programming as a way to
> store user- options prior to changing them, so that they may
> be restored. e.g.:
>
> 1 options missing='A';
> 2 %let restore=%sysfunc(getoption(missing, keyword));
> 3 options missing='B';
> 4 %put missing option is:%sysfunc(getoption(missing, keyword));
> missing option is:MISSING=B
> 5 %put will restore to:&restore;
> will restore to:MISSING=A
> 6 options &restore;
> 7 %put missing option is:%sysfunc(getoption(missing, keyword));
> missing option is:MISSING=A
>
> Often we specify missing=' ' so we get actual blanks in
> tables, not dots. Unfortunately this approach to restoring
> fails when the user has set missing=' ', because getoption
> returns missing=[one blank]. But on the attempt to restore,
> options missing= ; creates an error (SAS thinks you haven't
> specified the missing character, because the blank is not in quotes).
>
> 10 options missing=' ';
> 11 %let restore=%sysfunc(getoption(missing, keyword));
> 12 options missing='B';
> 13 %put missing option is:%sysfunc(getoption(missing, keyword));
> missing option is:MISSING=B
> 14 %put will restore to:&restore;
> will restore to:MISSING=
> 15 options &restore;
> NOTE: Line generated by the macro variable "RESTORE".
> 1 MISSING=
> -------
> 14
> ERROR 14-12: Invalid option value ; for SAS option MISSING.
>
> 16 %put missing option is:%sysfunc(getoption(missing, keyword));
> missing option is:MISSING=B
>
> Seems to me my life would be easier if getoption gave me some
> way to return the missing character in quotes. Same would
> also apply to formdlim. Obviously in this case an easy workaround is:
> options "&restore";
>
> But when writing a utility macro to store a list of options,
> this isn't as pretty.
|