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 (February 2012, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 1 Feb 2012 09:16:40 -0500
Reply-To:   Dan Abner <dan.abner99@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Dan Abner <dan.abner99@GMAIL.COM>
Subject:   IF/THEN condition in a SAS macro variable XXXX
Content-Type:   text/plain; charset=ISO-8859-1

Hi everyone,

I have the following code within a macro:

%IF &CUTOFF2 = NULL OR &CUTOFF2 = %THEN %LET EXPRESS = %NRSTR(%SYSEVALF(&DISTINCT/&N > &CUTOFF1)); %ELSE %IF &CUTOFF1 = NULL OR &CUTOFF1 = %THEN %LET EXPRESS = %NRSTR(%SYSEVALF(&DISTINCT > &CUTOFF2)); %ELSE %LET EXPRESS = %NRSTR(%SYSEVALF(&DISTINCT/&N > &CUTOFF1) & %SYSEVALF(&DISTINCT > &CUTOFF2));

%PUT EXPRESS = &EXPRESS; %IF %EVAL(%UPCASE(&TYPE) = N) & &EXPRESS %THEN %DO;

====

I receive the following in the SAS log:

EXPRESS = %SYSEVALF(&DISTINCT/&N > &CUTOFF1) ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: %EVAL(%UPCASE(&TYPE) = N) & &EXPRESS ERROR: The macro DATA_ASSAY will stop executing.

Any ideas?

Thanks!

Dan


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