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 (August 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 25 Aug 2006 11:14:03 +0200
Reply-To:     SAS-L List <sas-l@listserv.uga.edu>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Robert Bardos <bardos2@ANSYS.CH>
Subject:      Re: can SAS be stopped conditionally from executing last part of
              a code file in open code ?
In-Reply-To:  <082520060038.3203.44EE468A000205FA00000C83220588644205029A06CE9907@comcast.net>
Content-Type: text/plain; charset="iso-8859-1"

Actually the asterisk vs. blank solution in a macro variable was mentioned by Howard Schreier in his post from August 15.

I use it like this when I want to have an open code solution:

%let gonogo = %qsubstr(%str(* ),%eval(1+(&mycc > 0)),1);

When (&mycc > 0) evaluates to 0 (false) %qsubstr extracts the asterisk, when it evaluates to 1 (true) it extracts the blank from %str(* ) .

Example:

%let mycc = 1; %let gonogo = %qsubstr(%str(* ),%eval(1+(&mycc > 0)),1); %put MYCC=<&mycc> GONOGO=<&gonogo>;

&gonogo %put This statement will be executed;

%let mycc = 0; %let gonogo = %qsubstr(%str(* ),%eval(1+(&mycc > 0)),1); %put MYCC=<&mycc> GONOGO=<&gonogo>;

&gonogo %put This statement will be bypassed;

(Tested on z/OS with SAS 8.2)

Kind regards

Robert Bardos Ansys AG, Zürich, Switzerland

-----Ursprüngliche Nachricht----- Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von Ian Whitlock Gesendet: Freitag, 25. August 2006 02:39

<snipped&edited>

ENDSAS is a global compile time directive, not an executable statement. That is why you cannot write

if ... then endsas ;

The command must be hidden from the compiler. There are many ways to do that. One I haven't seen mentioned is

&gonogo endsas ;

where &GONOGO is an asterisk or null.

</snipped&edited>


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