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 (June 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 15 Jun 2007 09:44:35 -0400
Reply-To:   Jack Clark <JClark@CHPDM.UMBC.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Clark <JClark@CHPDM.UMBC.EDU>
Subject:   Re: picking the most performed procedure
Comments:   To: Annie Lee <hummingbird10111@HOTMAIL.COM>
In-Reply-To:   A<200706150840.l5EKleLt018358@mailgw.cc.uga.edu>
Content-Type:   text/plain; charset="us-ascii"

Annie,

Here is one way. It also can include the number of times the most performed procedure was performed.

(assuming your sample data was named TEST)

proc sql; create table test2 as select docid, procedurecode, count(procedurecode) as proc_cnt from test group by docid, procedurecode order by docid, proc_cnt desc ; quit;

data test3; set test2; by docid; if first.docid; run;

proc print data = test3; run;

Jack Clark Research Analyst Center for Health Program Development and Management University of Maryland, Baltimore County

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Annie Lee Sent: Friday, June 15, 2007 4:40 AM To: SAS-L@LISTSERV.UGA.EDU Subject: picking the most performed procedure

Hi,

I have a data set with doctor's id (multiple records for each doctor) and procedure_codes. I would like to pick the most performed procedure (one code) for each doctor. I would appreciate any help. Thank you. -Annie

Results I would like to have:

docid procedurecode

001111 21740 001112 50240 001113 48140 001114 53500 001115 21045

data set:

docid procedurecode

001111 21740 001111 21740 001111 21740 001111 21740 001111 21740 001111 20680 001111 20680 001112 50240 001112 50240 001112 50240 001112 52601 001112 52601 001112 55845 001113 48140 001113 48140 001113 48140 001113 48140 001113 48140 001113 48150 001113 48150 001113 47130 001113 47135 001114 53500 001114 53500 001114 53500 001114 53450 001114 53450 001115 21045 001115 21045 001115 21045 001115 21040 001115 21040


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