LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (August 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 13 Aug 2006 15:39:52 -0500
Reply-To:     "data _null_;" <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_;" <datanull@GMAIL.COM>
Subject:      Re: can SAS be stopped conditionally from executing last part of
              a code file in open code ?
Comments: To: Rune Runnestø <rune@fastlane.no>
In-Reply-To:  <XpGdnc0V_OBtFELZ4p2dnA@telenor.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

You can write endsas to file and %INC. using a data step. See below.

data work.one; input @01 a $5. @07 b $5.; datalines; hello Rune hei Mark ;;;; run; proc print; run; %let goon = yes; %let goon = no; %put &goon;

filename temp temp; data _null_; file temp; if upcase("&goon") eq 'NO' then put ';endsas;'; else put '*keep going;'; run; %inc temp / source2;

data work.two; input @01 a $5. @07 b $5.; datalines; hei Rune hello Mark ;;;; run; proc print; run;

On 8/13/06, Rune Runnestø <rune@fastlane.no> wrote: > Hi, > > I wonder if execution of a file can be stopped in the middle of a file in > open code. Here is an example: > > data one; > input > @01 a $5. > @07 b $5. > ; > datalines; > hello Rune > hei Mark > ; > run; > proc print; run; > %let goon = yes; > %let goon = no; > > %put &goon; > > /* This IF-statement is invalid, but what can I use to > avoid SAS running the rest of the file ? > */ > if &goon eq 'no' then stop; > > data two; > input > @01 a $5. > @07 b $5. > ; > datalines; > hei Rune > hello Mark > ; > run; > proc print; run; > > > As the code is now, the value of the macro variable GOON is 'no' when SAS > reach the data set two. > > > Regards, Rune >


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