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 (April 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 8 Apr 2003 15:26:26 +0200
Reply-To:     Michael.Eckhardt@T-SYSTEMS.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Michael.Eckhardt@T-SYSTEMS.COM
Subject:      AW: Problem (macro quoting/macro condition)
Content-Type: text/plain; charset="iso-8859-1"


the answer is quite simple. Because u use a Macro condition (%IF) and macro expressions are always strings you always compare the string component_id_1 or component_id_2 or ... with the string 0, which always is not equal, which always is true.

I assume u want to find out if the variables component_id_1, component_id_2, ... contain 0. So u just get rid or the %-signs to change the macro condition to a data step condition and the whole thing should work.

if component_id_&j ne 0 then do; /* resolves to if component_id_1, 2, ... ne 0 */ select (...); when (...); otherwise; end; end;

Mit freundlichen Grüßen Best regards

Michael Eckhardt Berater Business Intelligence T-Systems Systems Integration Geschäftsstelle Darmstadt/FDL-Mitte Frankfurter Str. 27

65760 Eschborn Tel. (06196) 961-540 Fax (0711) 120303-014499 Mobil (0171) 5762151

E-mail: Internet:

"Unfortunately, the current generation of mail programs do not have checkers to see if the sender knows what he is talking about" (A. S. Tanenbaum)

-----Ursprüngliche Nachricht----- Von: Basem [mailto:batawfic@YAHOO.COM] Gesendet: Dienstag, 8. April 2003 14:22 An: SAS-L@LISTSERV.UGA.EDU Betreff: Problem

Hi gurus

Why the %if condition is not working, whatever the content of component_id_(1-6) I always get true condition

%macro fill_K_component(indata=out1); data _null_; set indata; %do j=1 %to 6; %if component_id_&j ne 0 %then %do; select (component_id_&j); when (2654, 2655) if &component_K2 eq 0 then call symput('component_K2',component_id_&j); when (2656, 2657) if &component_K3 eq 0 then call symput('component_K3',component_id_&j); when (2658, 2659) if &component_K4 eq 0 then call symput('component_K4',component_id_&j); when (2660, 2661) if &component_K5 eq 0 then call symput('component_K5',component_id_&j); when (2662, 2663) if &component_K6 eq 0 then call symput('component_K6',component_id_&j); when (2664, 2665) if &component_K7 eq 0 then call symput('component_K7',component_id_&j); otherwise; end; %end; %end; run; %mend;

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