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 (September 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 29 Sep 2004 12:44:52 -0400
Reply-To:     ben.powell@CLA.CO.UK
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         ben.powell@CLA.CO.UK
Subject:      Re: Replace GOTO loop?

It failed again. I notice you write about whether the macro generates a step boundary or not? What does this mean, could this be the source of the error? When it fails the log goes crazy and dumps the same code over and over without producing any output, before I finally have to kill SAS - i.e. I can't kill the step. The macro contains two datasteps that read a file from a unix box and two proc sqls that count the rows in those files. The data step I;m having problems with is intended to loop that macro until a zero value is found, but after the first iteration it goes awol.

On Wed, 29 Sep 2004 11:32:40 -0400, Fehd, Ronald J. <RJF2@CDC.GOV> wrote:

>this is pretty simple, >as I wrote yesterday about why the call symput + %Put X<&X.> was off by >one: >remember perspective: resolution does not always happen >where you think you see it and expect it -- RJF2 > >the code that you think is call exec >is, in fact, executed in the next step >i.e. after your data _Null_ completes. > >what is the code in the macro bkm_check? >if it generates no step boundary >you can run it in-line: > >this is your why-doesn't-this-work example: >> data _NULL_; >> do while (symget('sumx') ^ = 0); >replace this: >> call execute('%bkm_check;'); >with this >%bkm_check; > >> end; > >Ron Fehd the macro maven CDC Atlanta GA USA > > >> From: ben.powell@CLA.CO.UK > >> I have the following abomination in some code that I have >> been forced to use having failed to get the required >> functionality from and do loops or if thens: >> >> data _NULL_; >> start: >> if symget('sumx') = 0 then goto exe; >> else if symget('sumx') > 0 then goto err; >> else call execute('%bkm_check;'); >> goto start; >> >> err: call execute('%put WARNING: Unexpected result in check >> macro;'); goto xyz; >> exe: call execute('data &importdataset;set bkm_check;run;'); >> goto xyz; xyz:; run; >> >> The execution of the macro bkm_check should eventually lead >> to the value of sumx being 0, although this may take several >> iterations - its checking to see when a remote file has >> stopped being written to and compares the recent and previous >> row count, completion being when the two counts are equal and >> the difference is zero. >> >> Obviously, with GOTO being the pariah statement (!) of >> programming I am loath to include any reference incase a >> future developer spurns my work. >> >> But all attempts thus far to use do-while have failed in a >> mire of non- execution and system hangs. >> >> For example, this doesn't work: >> >> data _NULL_; >> do while (symget('sumx') ^ = 0); >> call execute('%bkm_check;'); >> end; >> call execute('data &importdataset;set bkm_check;run;'); >> run; >> >> If someone could tell me why they don't expect the-do while >> above to work and perhaps suggest an alternative to the goto >> I would greatly appreciate it. >> >> Any comments much appreciated, >> >> Ben. >>

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