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 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 17 Mar 2009 16:11:39 -0400
Reply-To:     msz03@albany.edu
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Zdeb <msz03@ALBANY.EDU>
Subject:      Re: aggregate data
Content-Type: text/plain;charset=iso-8859-1

hi ... one idea (you'll most likely get a lot more !!!)

data x; input ID Ab1-Ab3; datalines; 1 0 0 0 1 6 0 6 1 0 6 0 1 0 0 0 1 0 0 0 2 0 0 0 2 0 0 1 2 0 0 0 2 1 0 0 ; run;

* assumes data in ID orders; data y; do until (last.id); set x; by id; drg = sum(drg,(ab1 eq 6),(ab2 eq 6),(ab3 eq 6)); end; drg = (drg gt 0); keep id drg; run;

proc print data=y; run;

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

> Hello All, > > > > I have the following data set: > > > > ID Ab1 Ab2 Ab3 > > 1 0 0 0 > > 1 6 0 6 > > 1 0 6 0 > > 1 0 0 0 > > 1 0 0 0 > > 2 0 0 0 > > 2 0 0 1 > > 2 0 0 0 > > 2 1 0 0 > > ... > > > > Then I want to come out with a data set that looks like this: > > ID DRG > > 1 1 > > 2 0 > > 3 0 > > 4 1 > > ... > > > > So, I want to come out with a new column named DRG, for example, and I want this new column to have a 1 (for YES) or a 0 (for NO) when Ab1 OR Ab2 OR > ab3 = 6 for each study ID. So I want to have an aggregated list that outputs the ID and if they ever had a 6 or not. > > > > Any help that you can give regarding this would be greatly appreciated! I have a way of doing something similar in SPSS but I thought I would ask > before I try to do the same type of thing in SAS. > > > > Thanks, > > Johnita > > > > > > _________________________________________________________________ > HotmailŪ is up to 70% faster. Now good news travels really fast. > http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009 >


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