LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 12 Oct 2006 12:05:16 -0400
Reply-To:     charles.harbour@PEARSON.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         charles.harbour@PEARSON.COM
Subject:      Re: Recovery from ERROR in Batch

When you run into an error, sas automatically sets obs=0 and will continue to perform the syntax check (their assumption is that you would still like to check your syntax, even though the run has failed) until it runs out of code, or reaches an errors limit that you may have already set. It also sets the automatic variable _error_ to 1.

If you look in the online doc, there's a whole chapter on error processing and debugging (along with using return codes, system vars, etc.). Chapter is SAS Language Reference: Concepts, Error processing and Debugging.


On Thu, 12 Oct 2006 11:07:17 -0400, Howard Schreier <hs AT dc-sug DOT org> <nospam@HOWLES.COM> wrote:

>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?

Back to: Top of message | Previous page | Main SAS-L page