| Date: | Wed, 24 Aug 2011 13:51:11 +0000 |
| Reply-To: | "Fehd, Ronald J. (CDC/OCOO/ITSO)" <rjf2@CDC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Fehd, Ronald J. (CDC/OCOO/ITSO)" <rjf2@CDC.GOV> |
| Subject: | Re: Conditional Macro |
| In-Reply-To: | <AD4D009B201C104A87056D05DAEA2C1DF719E3@AZPH-SRV-MAIL09.cvty.com> |
| Content-Type: | text/plain; charset="us-ascii" |
SAS does not speak the natural language English
nor grok the initial letters of shaking head Yes or No.
instead use boolean:
%let Gastro=1;
%If &Gastro. %then %do;
Ron Fehd logical macro maven
> -----Original Message-----
> From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
> On Behalf Of Adams, Nicholas
> Sent: Wednesday, August 24, 2011 9:45 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Conditional Macro
>
> I have a program that has a series of data steps and proc sqls. I have one
> section of it that I want to run if a condition is true. I set a macro variable
> called gastro at the begining of the code to be either Y of N. I cant seen to
> get the syntax right of running the section of code conditionally.
>
>
> example
>
> %let Gastro='Y';
>
> Proc Sql and Data steps
>
> %if &Gastro=Y %then %do;
>
> Data Steps
>
> %end;
>
> Rest of Proc Sql and Data Steps
>
>
>
>
> Thanks, Nick
>
>
> Email Confidentiality Notice: The information contained in this transmission is
> confidential, proprietary or privileged and may be subject to protection
> under the law, including the Health Insurance Portability and Accountability
> Act (HIPAA).
>
> The message is intended for the sole use of the individual or entity to whom
> it is addressed. If you are not the intended recipient, you are notified that
> any use, distribution or copying of the message is strictly prohibited and may
> subject you to criminal or civil penalties. If you received this transmission in
> error, please contact the sender immediately by replying to this email and
> delete the material from any computer.
|