Date: Thu, 12 Oct 2006 11:07:17 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Recovery from ERROR in Batch
The answer to question #2 is to code
options obs=max nosyntaxcheck;
instead of just
options obs=max;
Thanks to Robert Bardos for putting me on the right track.
On Mon, 9 Oct 2006 17:19:58 -0400, Howard Schreier <hs AT dc-sug DOT org>
<nospam@HOWLES.COM> wrote:
>The problem demonstrated below occurs only when the code is processed in batch.
>
>NOTE: SAS 9.1.3 Service Pack 4
>
>1 proc sql;
>2
>3 create table test (onlyvar numeric);
>NOTE: Table WORK.TEST created, with 0 rows and 1 columns.
>4
>5 insert into test
>6 set onlyvar = 1
>7 set onlyvar = 1;
>NOTE: 2 rows were inserted into WORK.TEST.
>
>8
>9 alter table test
>10 add constraint norepeat distinct(onlyvar);
>ERROR: Duplicate values not allowed on index onlyvar for file TEST.
>
>*** HS: I have attempted to add a constraint to a table which does not
>comply with the constraint. The ERROR is expected.
>
>NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of
>statements.
>11
>12 create table copy1 as
>13 select * from test;
>NOTE: Statement not executed due to NOEXEC option.
>14
>15 reset exec;
>16
>17 create table copy2 as
>18 select * from test;
>NOTE: Table WORK.COPY2 created, with 2 rows and 1 columns.
>
>*** HS: PROC SQL's EXEC option has been toggled, so the last statement was
>processed.
>
>19
>20 quit;
>NOTE: The SAS System stopped processing this step because of errors.
>
>*** HS: This is not true. PROC SQL did process statements after the ERROR
>was encountered.
>
>NOTE: SAS set option OBS=0 and will continue to check statements.
> This may cause NOTE: No observations in data set.
>NOTE: PROCEDURE SQL used (Total process time):
>
> real time 0.37 seconds
> cpu time 0.11 seconds
>
>21
>
>22 data copy3; set test; run;
>
>NOTE: The data set WORK.COPY3 has 0 observations and 1 variables.
>
>*** HS: Output data set is empty because of OBS=0.
>
>NOTE: DATA statement used (Total process time):
> real time 0.08 seconds
> cpu time 0.03 seconds
>
>23
>24 options obs=max;
>25
>26 data copy4; set test; run;
>
>NOTE: The data set WORK.COPY4 has 0 observations and 1 variables.
>
>*** HS: Why is output data set empty after OBS=MAX restored?
>
>NOTE: DATA statement used (Total process time):
> real time 0.01 seconds
> cpu time 0.02 seconds
>
>ERROR: Errors printed on page 1.
>
>NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
>NOTE: The SAS System used:
> real time 2.12 seconds
> cpu time 0.81 seconds
>
>So there are two questions:
>
>1. Why did SAS set OBS=0?
>
>2. Why did resetting OBS=MAX not permit SAS to resume normal processing?
|