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 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 5 Feb 2004 15:58:52 -0500
Reply-To:   "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject:   Re: Using a macro variable in a "where" clause
Content-Type:   text/plain; charset="iso-8859-1"

Jose:

I'm a little confused. Do the checkboxes have the same name? e.g.

<INPUT TYPE="checkbox" NAME="cb" VALUE=1>check box 1<BR> <INPUT TYPE="checkbox" NAME="cb" VALUE=2>check box 2<BR> <INPUT TYPE="checkbox" NAME="cb" VALUE=3>check box 3<BR> <INPUT TYPE="checkbox" NAME="cb" VALUE=4>check box 4<BR> <INPUT TYPE="checkbox" NAME="cb" VALUE=5>check box 5<BR>

If so, multiple macro variables will be created. I checked 1, 3 and 5 and the following macro variables were created by the program.

"cb" = "1" "cb0" = "3" "cb1" = "1" "cb2" = "3" "cb3" = "5"

Note that you should have a %global cb0 cb1; statement at the top of your program. That will allow you to access the checked values and use common logic to loop through them, even if only 1 box is checked:

%global cb0 cb1 where;

%macro do_check; %if &cb0 = %str() %then %do; %let cb1 = &cb; %let cb0 = 1; %end;

%do i = 1 %to &cb0; %let where = &where %quote(&&cb&i); %end; %mend;

%do_check;

%put Where is &where;

data _null_; file _webout; put 'Content-type: text/html'; put ; put "Where clause is &where"; run;

Perhaps you could give some more details around the "3 values in csv".

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Jose Santos Sent: February 5, 2004 2:59 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Using a macro variable in a "where" clause

I harvested some values (i.e., 3 values out of 10) from multiple checkboxes in an HTML form and then I passed it to the application dispatcher as a macro variable with 3 values in csv. Other than processing the content of the macro variable in a iterative do loop, are there alternative techniques to using it in a where clause in a data step?

Thanks. Jose


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