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 2012, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 13 Mar 2012 12:21:32 +0000
Reply-To:     "Zdeb, Michael S" <mzdeb@ALBANY.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Zdeb, Michael S" <mzdeb@ALBANY.EDU>
Subject:      Re: conditioning on value of 114 consecutive variables
Comments: To: CP Jen <plessthanpointohfive@GMAIL.COM>
In-Reply-To:  <201203130757.q2D4rHWD032745@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

hi ... you can use a WHERE statement in PROC PRINT with CMISS ...

data x; input a ae_other_1-ae_other_4; datalines; 1 . . . . 2 . . 9 9 3 8 9 7 6 ; run;

proc print data=x; where cmiss(ae_other_1 , ae_other_2 , ae_other_3 ,ae_other_4) ne 4; run;

however, with lots of variables, it's a pain since the WHERE statement doesn't support OF (like an IF statement would)

this is OK ...

data some_data; set x; if CMISS (OF AE_OTHER_:) NE 4; run;

this is not ...

proc print data=x; WHERE CMISS (of AE_OTHER_:) NE 4; run;

but, you could try this to write all the variable names for you ...

%macro whereof(func,var,n,also); where &also &func( %do j=1 %to %eval(&n-1); &var&j , %end; &var&j ) %mend;

proc print data=x; %whereof(cmiss, ae_other_ , 4) ne 4; run;

and with your data ...

%whereof(cmiss, ae_other_ , 114) ne 114;

Mike Zdeb U@Albany School of Public Health One University Place (Room 119) Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

________________________________________ From: SAS(r) Discussion [SAS-L@LISTSERV.UGA.EDU] on behalf of CP Jen [plessthanpointohfive@GMAIL.COM] Sent: Tuesday, March 13, 2012 3:57 AM To: SAS-L@LISTSERV.UGA.EDU Subject: conditioning on value of 114 consecutive variables

Hi SAS-L;

I have a data set that is one-to-one for >4000 individuals. There is are variables called ae_other_1 to ae_other_114.

I would like to select observations what have data in at least one of the 114 ae_other variables. Some folks will have zero data in any of the 114 variables. In fact, many of them will not have that data. I want to exclude those.

Of course, I could use syntax like, " if ae_other_1 ne . | ae_other_2 ne . | etc. But that will take forever.

Is there a way to do this without reffing each variable individually, such how we can use "ae_other_1-ae_other_114" for a proc print, means, or freq?

Thanks,

Jen


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