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 (April 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 11 Apr 2005 05:28:45 -0400
Reply-To:   Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Subject:   Re: select observation
Comments:   To: greenmt@GMAIL.COM

Hi Jerry,

*Untested* code:

%MACRO Print9s; %LOCAL I; proc print data=test; where %DO I = 1 %TO 15; Q&I EQ 9 %* no semicolon with this SAS code; %IF (&I LT 15) %THEN OR; %* single semicolon ends %IF, not SAS code; %END; ; * semicolon ends WHERE statement; run; %MEND Print9s;

%Print9s;

Regards - Jim. -- Y. (Jim) Groeneveld, MSc., Biostatistician, Vitatron b.v., NL Jim.Groeneveld_AT_Vitatron.com (replace _AT_ by AT sign) http://www.vitatron.com, http://home.hccnet.nl/jim.groeneveld

[common disclaimer]

On Sun, 10 Apr 2005 22:33:52 -0700, Jerry <greenmt@GMAIL.COM> wrote:

>Hi, > >I have 15 consecutive numeric variables,(q1, q2, .... q15). My >objective is to list all observations for which any of the 15 varibles >contains a numeric value "9". Below is the code I wrote, using PROC >PRINT w/ WHERE statement. > >proc print data=test; >where q1=9 or q2=9 or q3=9 or q4=9 or q5=9 or q6=9 or q7=9 or q8=9 or >q9=9 or q10=9 or q11=9 or q12=9 or q13=9 or q14=9 or q15=9; >run; > >My clumsy code works fine, but I wonder if there's a better way to >achieve my objective. > >Thanks. >Jerry


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