Date: Fri, 5 Sep 2008 16:38:50 -0400
Reply-To: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject: Re: macro problem
Content-Type: text/plain; charset=us-ascii
> %if %upcase(%substr(&dat,1,2))=HS %then %do;
or, if you insist that your test is quoted:
> %if "%upcase(%substr(&dat,1,2))"="HS" %then %do;
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov
> -----Original Message-----
> From: email@example.com
> [mailto:firstname.lastname@example.org] On Behalf Of Jamil Ibrahim
> Sent: Friday, September 05, 2008 4:35 PM
> To: sas
> Cc: Jamil Ibrahim
> Subject: macro problem
> What is wrong with macro?
> %macro dept;
> %if %upcase(%substr("&dat",1,2))="HS" %then %do;
> %let tit=%str(DEPARTMENT OF HEALTH SCIENCES); %end;
> %else %if %upcase(%substr("&dat",1,2))="HI" %then %do;
> %let tit=%str(DEPARTMENT OF HEALTH INFORMATION MANAGEMENT); %end;
> %mend; %dept;
> NOTE: One or more missing close parentheses have been
> supplied for the %UPCASE function.
> ERROR: A character operand was found in the %EVAL function or
> %IF condition where a numeric operand is required. The condition was:
> ERROR: The macro DEPT will stop executing.
> Dr. Jamil Ibrahim, Ph.D.
> Scientist IV
> Professor , SHRP
> Research Supervisor
> Univ. Of Miss. Med. CTR.
> 2500 N state St
> Jackson, MS 39216
> Tel. 601-984-1197
> Fax 601-984-1205
> Nternet: email@example.com
> The information contained in the attachment(s) to this email
> is confidential. If you were not expecting a confidential
> email from the Department of Institutional Research at the
> University of Mississippi Medical Center, please do not view,
> open, disclose, reproduce, distibute or otherwise use this
> attachment. If you received this email in error, please
> notify me immediately. Thank you.
> Individuals who have received this information in error or
> are not authorized to receive it must promptly return or
> dispose of the information and notify the sender. Those
> individuals are hereby notified that they are strictly
> prohibited from reviewing, forwarding, printing, copying,
> distributing or using this information in any way.