Date: Fri, 8 Sep 2006 20:03:18 +1200
Reply-To: Robin Templer <robin.templer@XTRA.CO.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin Templer <robin.templer@XTRA.CO.NZ>
Subject: Re: strange difference in behavior batch vs interactive
Content-Type: text/plain; charset="US-ASCII"
You need
OPTIONS NOSYNTAXCHECK;
But be very careful !!! It is a not a batch default for a darn good reason
!!!
I have to admit to using this option in very rare circumstances in batch
programmes - after some serious questioning from my peers.
My 2 cents worth, is fix your code so that is does not issue errors.
Cheers
Robin
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
toby989@HOTPOP.COM
Sent: Friday, 8 September 2006 5:14 a.m.
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: strange difference in behavior batch vs interactive
Then, can I change the replace/noreplace system option? I tried to set the
option replace in my sas code that I am running batch, but it hadnt had an
effect.
Does it help to copy the configuration file into the directory from which I
start to run the batch sas?
Win2K SAS 9.1.3
libname psdata 'c:\project\ps\data';
options replace;
%macro efamac(o5=,o3=,o1=,m=,n=,o2=,norm=,priors=,r=,k=);
proc corr data=psdata.ps2004ms(where=(id<200 and id not in (49, 109) and
half=0)) &o5 out=outcor noprint;
.
.
.
.
.
run;
%mend;
data _null_;
.
.
do o5=1 to 10000;
call
execute('%nrstr(%efamac(o5='||o5||',o3='||o3||',o1='||o1||',m='||m||',n='||n
||',o2='||o2||',norm='||norm||',priors='||priors||',r='||r||',k='||trim(left
(k))||'))');
end;
run;
Lou wrote:
> You don't tell us your platform or version or show us your code, so
specific
> answers are somewhat difficult, but there are differences in default
> behavior between batch and interactive.
>
> Perhaps the biggest difference is that in batch, an ERROR puts the session
> into "syntax check mode" - the OBS option is set to 0 and the
> REPLACE/NOREPLACE option to NOREPLACE. So the remaining statements are
read
> and checked for validity, global statements are executed, other errors
> identified, output dataset descriptors are created, but no observations to
> new data sets are written and existing datasets of the same name are not
> overwritten. Additionally, most subsequent steps are not executed (PROC
> DATASETS and PROC CONTENTS are exceptions).
>
> In interactive sessions, syntax check mode is in effect only for the step
> generating the ERROR - so the remaining portion of the program will
execute.
> Whether or not you can trust the results when some earlier step didn't
> produce whatever it was supposed to produce is another question.
>
> On Windows, the other big difference is the active or home directory for
the
> session. In interactive mode, the default directory is the SAS root
> directory. In batch, it's the directory where the program is located.
This
> can mean that statements that work just dandy in batch give different
> (erroneous) results in interactive.
>
>
> <toby989@hotpop.com> wrote in message
news:edoi9n$mij$1@news.Stanford.EDU...
>
>>Why is it that I get different behavior of SAS when I run it interactively
>
> or
>
>>when I run it in batch? Especially if there occurr errors in one of a
>>proc/datastep? I would like the batch behave like the interactive. I konw
>
> I
>
>>would have to set some environment settings, I already did one: the
>
> libname, but
>
>>I dont know what I have to set for discrepancy below. And why, in batch,
>
> is
>
>>there not an old verion (1) from the previous iteration of the macro of
>
> the
>
>>dataset there anymore, unlike in interactive? If there would be an old
>
> version
>
>>then the new iteration could just take the old dataset, and that would be
>
> fine
>
>>with me (just as it is doing in interactive). And the crazy thing is that
>>procs/datasteps of a next and unrelated iteration of the macro cannot
>
> replace
>
>>miscreated datasets from the previous iteration, as if some proc still
>
> 'sits' on
>
>>one of such an old 'unfinished' dataset (see (1) above). Or, why would
>
> errors in
>
>>a previous iteration have an effect on a, for example, proc corr that gets
>
> it
>
>>input from a saved static dataset?
>>
>>NOTE: The data set WORK.OUTCOR has 0 observations and 0 variables.
>>WARNING: Data set WORK.OUTCOR was not replaced because new file is
>
> incomplete.
>
>>NOTE: PROCEDURE CORR used (Total process time):
>> real time 0.00 seconds
>> cpu time 0.00 seconds
>>
>>
>>
>>
>>-----------interactively---------------
>>NOTE: The data set WORK.OUTCOR has 41 observations and 40 variables.
>>NOTE: PROCEDURE CORR used (Total process time):
>> real time 0.23 seconds
>> cpu time 0.23 seconds
>>
>>
>>
>>
>>NOTE: The NOINT option causes all moments to be computed about the origin.
>>Correlations,
>> covariances, standard deviations, etc., are not corrected for the
>
> mean.
>
>>NOTE: N not equal across variables in data set WORK.OUTCOR. This may not
>
> be
>
>>appropriate. The
>> smallest value will be used.
>>NOTE: 3 factors will be retained by the NFACTOR criterion.
>>NOTE: Convergence criterion satisfied.
>>ERROR: Rotation method failed to converge in 10000 cycles. You may attempt
>
> to
>
>>set a larger number
>> using the RITER= option.
>>NOTE: The SAS System stopped processing this step because of errors.
>>WARNING: The data set WORK.OUT may be incomplete. When this step was
>
> stopped
>
>>there were 48
>> observations and 40 variables.
>>WARNING: Data set WORK.OUT was not replaced because this step was stopped.
>>NOTE: PROCEDURE FACTOR used (Total process time):
>> real time 0.23 seconds
>> cpu time 0.23 seconds
>>
>>
>>
>>
>>NOTE: There were 3 observations read from the data set WORK.OUT.
>> WHERE _type_='PATTERN';
>>NOTE: The data set WORK.A has 3 observations and 40 variables.
>>NOTE: DATA statement used (Total process time):
>> real time 0.01 seconds
>> cpu time 0.01 seconds
>>
>>
>>
>>NOTE: There were 3 observations read from the data set WORK.A.
>>NOTE: The data set WORK.B has 38 observations and 4 variables.
>>NOTE: PROCEDURE TRANSPOSE used (Total process time):
>> real time 0.03 seconds
>> cpu time 0.03 seconds
>>
>>
>>
>>
>>
>>
>>
>>-----------batch--------------------------
>>NOTE: The data set WORK.OUTCOR has 41 observations and 40 variables.
>>NOTE: PROCEDURE CORR used (Total process time):
>> real time 0.21 seconds
>> cpu time 0.20 seconds
>>
>>
>>
>>NOTE: The NOINT option causes all moments to be computed about the origin.
>>Correlations,
>> covariances, standard deviations, etc., are not corrected for the
>
> mean.
>
>>NOTE: N not equal across variables in data set WORK.OUTCOR. This may not
>
> be
>
>>appropriate. The
>> smallest value will be used.
>>NOTE: 3 factors will be retained by the NFACTOR criterion.
>>NOTE: Convergence criterion satisfied.
>>ERROR: Rotation method failed to converge in 10000 cycles. You may attempt
>
> to
>
>>set a larger number
>>ERROR: Rotation method failed to converge in 10000 cycles. You may attempt
>
> to
>
>>set a larger number
>>ERROR: Rotation method failed to converge in 10000 cycles. You may attempt
>
> to
>
>>set a larger number
>> using the RITER= option.
>> using the RITER= option.
>> using the RITER= option.
>>NOTE: The SAS System stopped processing this step because of errors.
>>NOTE: SAS set option OBS=0 and will continue to check statements.
>> This may cause NOTE: No observations in data set.
>>WARNING: The data set WORK.OUT may be incomplete. When this step was
>
> stopped
>
>>there were 48
>> observations and 40 variables.
>>WARNING: Data set WORK.OUT was not replaced because this step was stopped.
>>NOTE: PROCEDURE FACTOR used (Total process time):
>> real time 0.21 seconds
>> cpu time 0.21 seconds
>>
>>
>>
>>
>>NOTE: The data set WORK.A has 0 observations and 40 variables.
>>WARNING: Data set WORK.A was not replaced because this step was stopped.
>>NOTE: DATA statement used (Total process time):
>> real time 0.01 seconds
>> cpu time 0.01 seconds
>>
>>
>>
>>NOTE: There were 0 observations read from the data set WORK.A.
>>NOTE: The data set WORK.B has 38 observations and 1 variables.
>>NOTE: PROCEDURE TRANSPOSE used (Total process time):
>> real time 0.01 seconds
>> cpu time 0.01 seconds
>>
>>
>>---batch, subsequent macro call after erroneous procs of previous macro
>
> call---
>
>>---code:
>>proc corr data=psdata.ps2004ms(where=(id<200 and id not in (49, 109) and
>>half=0)) &o5 out=outcor noprint;
>>var ........,
>>run;
>>-----------
>>NOTE: The data set WORK.OUTCOR has 0 observations and 0 variables.
>>WARNING: Data set WORK.OUTCOR was not replaced because new file is
>
> incomplete.
>
>>NOTE: PROCEDURE CORR used (Total process time):
>> real time 0.00 seconds
>> cpu time 0.00 seconds
>>
>
>
>
|