From: Joe Matise on
There is. I don't recall off the top of my head, but there is an automatic
macro variable that is set when you are in batch. Either google about for
it (or maybe look on the sascommunity.org site), or put the macro variables
to the log in both sessions and look at the difference. I think it's %put
_automatic_; to do that.

-Joe

On Thu, Jan 28, 2010 at 7:35 PM, Andrea Zimmerman
<sassywench74va(a)gmail.com>wrote:

> I've got some code that normally runs in batch at night, but occasionally I
> run it in interactive PC SAS. Problem is I have a proc printto to redirect
> the log for batch processing that I have to comment out when I run it
> interactively.
>
> But then I sometimes for get to uncomment it.
>
> It would be so much easier if I could have the code determine if it is
> running interactively or in batch and then decide whether to execute the
> proc printto based on that.
>
> TIA
>
> --
> Andrea W-Z
>
From: Arthur Tabachneck on
Andrea,

Take a look at:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a00
0543674.htm
or, in short form: http://xrl.us/bgt2sq

It describes &sysenv

HTH,
Art
--------
On Thu, 28 Jan 2010 20:35:08 -0500, Andrea Zimmerman
<sassywench74va(a)GMAIL.COM> wrote:

>I've got some code that normally runs in batch at night, but occasionally
I
>run it in interactive PC SAS. Problem is I have a proc printto to
redirect
>the log for batch processing that I have to comment out when I run it
>interactively.
>
>But then I sometimes for get to uncomment it.
>
>It would be so much easier if I could have the code determine if it is
>running interactively or in batch and then decide whether to execute the
>proc printto based on that.
>
>TIA
>
>--
>Andrea W-Z
From: xlr82sas on
On Jan 28, 7:22 pm, art...(a)NETSCAPE.NET (Arthur Tabachneck) wrote:
> Andrea,
>
> Take a look at:http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/defau...
> 0543674.htm
> or, in short form:http://xrl.us/bgt2sq
>
> It describes &sysenv
>
> HTH,
> Art
> --------
> On Thu, 28 Jan 2010 20:35:08 -0500, Andrea Zimmerman
>
>
>
>
>
> <sassywench7...(a)GMAIL.COM> wrote:
> >I've got some code that normally runs in batch at night, but occasionally
> I
> >run it in interactive PC SAS.  Problem is I have a proc printto to
> redirect
> >the log for batch processing that I have to comment out when I run it
> >interactively.
>
> >But then I sometimes for get to uncomment it.
>
> >It would be so much easier if I could have the code determine if it is
> >running interactively or in batch and then decide whether to execute the
> >proc printto based on that.
>
> >TIA
>
> >--
> >Andrea W-Z- Hide quoted text -
>
> - Show quoted text -

Hi,

SYSENV may work for you, unfortunately when I remotely submit code
to UNIX the UNIX sysenv is 'BACK' not 'FORE'

I think you can test to see if sysin is populated. I collect meta
data only when programs are run in batch. The meta data is not
collected if the program is run interactively. The technique below
seems prety robust.

%if %sysfunc(getoption(SYSIN))= %then %let utlenv=FORE


From: "Data _null_;" on
On 1/29/10, Fehd, Ronald J. (CDC/CCHIS/NCPHI) <rjf2(a)cdc.gov> wrote:
> %sysfunc(ifc(%sysfunc(getoption(SYSIN)) eq
> ,%nrstr(PROC PrintTo;)
> ,%nrstr(%Put Note: is.a session;);
> )
>
> notes:
> 1. you may need this as the condition:
>
> %sysfunc(ifc("%sysfunc(getoption(SYSIN))" eq ""

Indeed you do at least on my Windows SAS 9.1.3, but I want to use
proper macro quoting and experimented with various quoting functions
but the only way I could figure was to use %SYSEVALF and QSYSFUNC.

%sysfunc(ifc(%sysevalF(%Qsysfunc(getoption(SYSIN)) eq,BOOLEAN)
,%nrstr(PROC PrintTo /*include proper options*/;run;)
,%nrstr(%Put Note: is.a session;)
))
From: Andrea Zimmerman on
This was perfect! Thanks

On Thu, Jan 28, 2010 at 10:22 PM, Arthur Tabachneck <art297(a)netscape.net>wrote:

> Andrea,
>
> Take a look at:
> http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a00
> 0543674.htm
> or, in short form: http://xrl.us/bgt2sq
>
> It describes &sysenv
>
> HTH,
> Art
> --------
> On Thu, 28 Jan 2010 20:35:08 -0500, Andrea Zimmerman
> <sassywench74va(a)GMAIL.COM> wrote:
>
> >I've got some code that normally runs in batch at night, but occasionally
> I
> >run it in interactive PC SAS. Problem is I have a proc printto to
> redirect
> >the log for batch processing that I have to comment out when I run it
> >interactively.
> >
> >But then I sometimes for get to uncomment it.
> >
> >It would be so much easier if I could have the code determine if it is
> >running interactively or in batch and then decide whether to execute the
> >proc printto based on that.
> >
> >TIA
> >
> >--
> >Andrea W-Z
>



--
Andrea W-Z