| Date: | Fri, 21 Jan 2011 16:03:47 -0600 |
| Reply-To: | Joe Matise <snoopy369@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Joe Matise <snoopy369@GMAIL.COM> |
| Subject: | Re: clean work directory |
|
| In-Reply-To: | <CD415D3D621245ABA3F3238569828797@D1871RB1> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
|---|
%let FileSpec=%sysfunc(ifc("%sysfunc(getoption(SysIn))" ne ""
,%nrstr(%sysfunc(getoption(SysIn)))
,%nrstr(%sysget(SAS_EXECFILEPATH))
) );
x "sas.exe &filespec"; <populating current file name
endsas;
Maybe? :)
-Joe
On Fri, Jan 21, 2011 at 3:50 PM, Nat Wooding <nathani@verizon.net> wrote:
> Art
>
> I like that even better, especially if it reran the Autoexec and Config
> files.
>
>
>
> Nat
>
> KwAutoexec kwConfig
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Arthur
> Tabachneck
> Sent: Friday, January 21, 2011 4:44 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: clean work directory
>
> Nat,
>
> Conversely, it would be nice to simply have a system command that restarts
> a
> session. Anyone from SAS listening?
>
> Art
>
> kwsuggestion kwrestart
> -------
> On Fri, 21 Jan 2011 16:37:42 -0500, Nat Wooding <nathani@VERIZON.NET>
> wrote:
>
> >I have not noticed anyone mentioning it but for those who do graphics, it
> >would be a good time to reset the Goptions. In keeping with this vein, how
> >about resetting other Options to their defaults or the defaults that the
> >user likes. Obviously, the latter would require some individualized fine
> >tuning.
> >
> >Nat Wooding
> >
> >-----Original Message-----
> >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Mike
> >Rhoads
> >Sent: Friday, January 21, 2011 4:22 PM
> >To: SAS-L@LISTSERV.UGA.EDU
> >Subject: Re: clean work directory
> >
> >Quentin,
> >
> >Very nice! This is something I have thought about often (actually earlier
> >today, strangely enough), but had never gotten around to doing anything
> >about.
> >
> >I don't see any obvious holes. However, since SAS (at least on some
> >platforms) already has a "cleanwork" utility that performs a slightly
> >different function, I'd suggest a different name for this macro. Perhaps
> >%ResetSession?
> >
> >I was a little curious about the pair of DATA steps -- couldn't the macro
> >variable deletion be done in a single step without the need for the __TMP
> >data set? I also wondered whether the "name not like "SYS%"" restriction
> >was necessary, since when I looked at SASHELP.VMACRO the scope of these
> was
> >AUTOMATIC rather than GLOBAL.
> >
> >I was surprised that the LIBNAME _ALL_ and FILENAME _ALL_ statements
> cleared
> >the corresponding references without the CLEAR keyword at the end of the
> >statements. I would be tempted to put the CLEARs in anyway just for
> clarity
> >(no pun intended).
> >
> >And I also think that those who do set up librefs etc. in AUTOEXEC files
> >could come up with ways to have that coexist with this type of macro.
> >
> >Let us know how it goes -- sounds like it could be a great conference
> paper
> >at some point!
> >
> >
> >Mike Rhoads
> >RhoadsM1@Westat.com
> >
> >
> >
> >-----Original Message-----
> >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Quentin
> >McMullen
> >Sent: Friday, January 21, 2011 1:47 PM
> >To: SAS-L@LISTSERV.UGA.EDU
> >Subject: clean work directory
> >
> >Hi All,
> >
> >Well, on a snowy Friday I am trying to figure out the best way that I
> >can fake initialization of a SAS session when running interactively
> >(in Windows).
> >
> >That is, imagine I'm doing development work all day, in an interactive
> >session. Before I run a program at 1:00pm, I want to make sure there
> >is nothing hanging around in the work directory (or elsewhere) that
> >would effect the run. I hate to have code that works in interactive,
> >then fails in batch because I forgot that I had a
> >(format/macro/whatever) previously defined. Of course, I could close
> >SAS and restart, but who wants to do that every time before a
> >development run.
> >
> >I want %CleanWork to delete any datasets, global macro variables,
> >clear librefs, etc etc. To replicate starting a new SAS sesssion. I
> >might even leave it at the top of my program, beefore I set up
> >libnames/options/etc.
> >
> >Note: I have it clear libnames and filenames, because I do not use
> >autoexec / config to set these. Obviously if you setup libnames ,
> >define macros, or whatever, in a config file, this sort of cleanwork
> >would be a bad idea.
> >
> >I did not attempt to reset global options to the default, because I do
> >use config files to set some options (consistent in my
> >inconsistency...).
> >
> >So am I forgetting anything big that I should add to this? Anybody
> >think this could break something?
> >
> >Kind Regards,
> >--Quentin
> >
> >%macro cleanwork(dummy);
> >%*Replicate the intial environment that is created for a new
> >interactive session.
> > Macro clears titles, footnotes, global macro variables,
> > macro definitions in work.sasmcr, work datasets, work format catalog.
> >;
> >
> >title1;
> >footnote1;
> >libname _all_;
> >filename _all_;
> >
> >%*delete global macro variables;
> >%*offset handles macro vars with long values;
> >data __tmp;
> > set sashelp.vmacro;
> > where scope='GLOBAL' and offset=0 and name not like "SYS%";
> >run;
> >data _null_;
> > set __tmp;
> > call execute('%symdel '||trim(left(name))||';');
> >run;
> >
> >proc datasets library=work kill nolist;
> >quit;
> >
> >*delete macro definitions;
> >proc catalog catalog=work.sasmacr force ;
> > save cleanwork.macro;
> >quit;
> >
> >%mend cleanwork;
>
|