Groups | Search | Server Info | Login | Register
Groups > comp.soft-sys.sas > #932
| From | RolandRB <rolandberry@hotmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.sas |
| Subject | Re: formdlim=" " missing=" " |
| Date | 2011-06-15 11:32 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <8d9d8bd2-1729-4137-95cb-67ae994f16b1@l2g2000prg.googlegroups.com> (permalink) |
| References | <ad06163d-97ed-44cf-8082-9e638d5dd588@i4g2000yqg.googlegroups.com> <1dcef7bb-254a-4a16-ac28-cb763b255c0a@z7g2000prh.googlegroups.com> <57d430df-d729-4177-8f15-b3e4bbd254a0@16g2000yqy.googlegroups.com> <52942454-4e39-4a6c-9675-abb8b278cc31@z7g2000prh.googlegroups.com> |
On Jun 15, 5:41 pm, "data _null_;" <iebup...@gmail.com> wrote:
> On Jun 15, 6:46 am, RolandRB <rolandbe...@hotmail.com> wrote:
>
>
>
>
>
> > On Jun 14, 7:37 pm, "data _null_;" <iebup...@gmail.com> wrote:
>
> > > On Jun 14, 10:27 am, RolandRB <rolandbe...@hotmail.com> wrote:
>
> > > > formdlim=" " missing=" " are both sas options that will mess up if you
> > > > try to save them with %sysfunc(getoption(XXX,keyword)) and try to
> > > > restore them later and I am wondering if there are any more examples
> > > > of this case in this wonderful piece of software we all know and love.
>
> > > Use the correct tools. OPTSAVE and OPTLOAD.
>
> > > options missing='?';
> > > proc optsave;
> > > run;
>
> > > options missing=" " nomprint;
>
> > > %put %sysfunc(getoption(missing,keyword))
> > > %sysfunc(getoption(mprint,keyword));
>
> > > data test;
> > > a=10;b=.;
> > > run;
>
> > > proc optload;
> > > run;
> > > %put %sysfunc(getoption(missing,keyword))
> > > %sysfunc(getoption(mprint,keyword));
>
> > > proc print data=test;
> > > run;
>
> > I would not use OPTSAVE and OPTLOAD in that form in a utility macro in
> > case I overwrote an existing dataset created by a previous OPTSAVE. I
> > could specify a dataset but I would want to check on its existence
> > first and chose another name if it existed and check on the new name
> > as well. So it starts to get messy. It would be a lot better if sas
> > software worked the way they say it works as on the following page.
>
> >http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default...
>
> > KEYWORD returns option values in a KEYWORD= format that would be
> > suitable for direct use in the SAS OPTIONS or GOPTIONS global
> > statements.
>
> > Note: For a system option with a null value, the GETOPTION function
> > returns a value of ' ' (single quotation marks with a blank space
> > between them), for example EMAILID=' '.- Hide quoted text -
>
> > - Show quoted text -
>
> Let SAS handle the naming an checking for you.
>
> options missing='?';
> proc optsave out=_data_;
> run;
> %let optdata=&syslast;
> %put NOTE: OPTDATA=&optdata;
>
> options missing=" " nomprint;
>
> %put %sysfunc(getoption(missing,keyword),$quote32.)
> %sysfunc(getoption(mprint,keyword));
>
> data test;
> a=10;b=.;
> run;
>
> proc optload data=&optdata;
> run;
> %put %sysfunc(getoption(missing,keyword))
> %sysfunc(getoption(mprint,keyword));
>
> proc print data=test;
> run;- Hide quoted text -
>
> - Show quoted text -
I don't want to use "proc optsave" or "proc optload" in a submacro
because I would have to check the output dataset name for its
existence and change it if it existed into something else and store
for use when I restore the options.
As for your snippet of code then this is what I get in the log when I
assign it to a macro variable and resolve it in an "options" statement
(and I also note you are changing the form of the expression for the
"missing" option which is not ideal).:
14 options missing=" " nomprint;
15
16
17 %let oldopts=%sysfunc(getoption(missing,keyword),$quote32.)
18 %sysfunc(getoption(mprint,keyword));
19
20 options &oldopts;
NOTE: Line generated by the macro variable "OLDOPTS".
20 "MISSING=" NOMPRINT
----------
13
ERROR 13-12: Unrecognized SAS option name, "MISSING=".
I am happy to use "optsave" and "optload" at the top level of the code
but not in any submacros or submacros of submacros.
This get-around utility macro works fine:
http://www.datasavantconsulting.com/roland/Spectre/utilmacros/savopts.sas
When the SI finally works out that they messed up the above macro will
still work fine.
Back to comp.soft-sys.sas | Previous | Next — Previous in thread | Next in thread | Find similar
formdlim=" " missing=" " RolandRB <rolandberry@hotmail.com> - 2011-06-14 08:27 -0700
Re: formdlim=" " missing=" " "data _null_;" <iebupdte@gmail.com> - 2011-06-14 10:37 -0700
Re: formdlim=" " missing=" " RolandRB <rolandberry@hotmail.com> - 2011-06-15 04:46 -0700
Re: formdlim=" " missing=" " RolandRB <rolandberry@hotmail.com> - 2011-06-15 06:13 -0700
Re: formdlim=" " missing=" " "data _null_;" <iebupdte@gmail.com> - 2011-06-15 08:41 -0700
Re: formdlim=" " missing=" " RolandRB <rolandberry@hotmail.com> - 2011-06-15 11:32 -0700
Re: formdlim=" " missing=" " "data _null_;" <iebupdte@gmail.com> - 2011-06-15 14:34 -0700
Re: formdlim=" " missing=" " RolandRB <rolandberry@hotmail.com> - 2011-06-16 15:33 -0700
csiph-web