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 (March 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 24 Mar 2009 22:23:45 -0500
Reply-To:     "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "./ ADD NAME=Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Macro condition for blank value
Comments: To: Harry <dj_epw@yahoo.com>
In-Reply-To:  <200903250254.n2OKBZXs019378@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

You are NOT creating macro variables for each record in BASE as you might think...

data BASE2001; input ID UEN $; cards; 1 ABCD 2 . 3 IJKL ;;;; run; proc sql; select uen,count(*) into :uen,:cnt from base2001; quit; %put _user_;

GLOBAL CNT 3 GLOBAL UEN ABCD

However, I see no evidence of a need for such macro variables looking at macro test. Here is "working" code. But I don't think it is a good idea to do it this way.

data BASE2001; input ID UEN $; cards; 1 ABCD 2 . 3 IJKL ;;;; run; proc sql; select uen,count(*) into :uen1-:uen999,:cnt from base2001; quit; %put _user_;

%macro test; data _null_; %do i=1 %to &cnt; %if %superQ(UEN&i) eq %then %do; %put NOTE:&i **&&uen&i**; %end; %end; %mend test; %test;

On 3/24/09, Harry <dj_epw@yahoo.com> wrote: > Hi Guys, > > I have the following dataset (BASE2001) which has 3 observations. In my > macro I want to perform steps based on the condition where UEN is blank. > However I am not getting the desired output. > > BASE2001 > -------- > ID UEN > 1 ABCD > 2 > 3 IJKL > > proc sql; > select uen,count(*) into :uen,:cnt from base2001; > quit; > > %macro test; > data _null_; > %do i=1 %to &cnt; > %if %trim(&UEN) = %then %do; > . > . > . > %end; > %end; > %mend test; > %test; >


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