LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 4 Nov 2011 07:08:52 -0400
Reply-To:     Nat Wooding <nathani@VERIZON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <nathani@VERIZON.NET>
Subject:      Re: Passing a variable value as condition into a where clause
In-Reply-To:  <201111040841.pA41IEWL030408@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="UTF-8"

Fernando

Jim gave an approach and here is another which evaluates the values in target in a loop.

Nat Wooding

data Source; numcli=1; Typcli="1111"; Target= "1111,21"; output; numcli=2; Typcli="1211"; Target= "1111,21"; output; run;

Data Wanted; set source; drop _I_ ; Do _i_ = 1 to ( countc( target , ',' ) +1 );

if Typcli = Scan( target , _i_ , ',' ) then output; end; run;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Fernando Tenorio Sent: Friday, November 04, 2011 4:42 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Passing a variable value as condition into a where clause

Hello everybody,

I’m trying to use the value of a variable in a where clause as the example below:

data Source; numcli=1; Typcli="1111"; Target="Typcli in ('1111','21')"; output; numcli=2; Typcli="1211"; Target="Typcli in ('1111','21')"; output; run;

data target_out; set source; where target; run;

And I would like to have as output: Numcli TypeCli 1 1111

But the where clause is not working as desired. I would like to know how could I pass the value of the variable "target" into the where clause.

Many thanks, Fernando Tenorio.


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