Date: Mon, 25 Jan 2010 12:18:08 -0500
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: grouping medical procedure codes using ranges of codes
Content-Type: text/plain;charset=iso-8859-1
hi ... instead of merging files, how about using the grouping file to make a format ...
I'm assuming your 3rd line is incorrect and data file always is the start then end of a group
(if not, then you could modify the following to check for that condition and reverse the start/end of the groups)
data fmt;
retain fmtname '$pr2grp';
infile datalines dsd;
input (start end) (: $5.) label : $1.;
datalines;
61106,61110,1
61230,61230,2
64550,64590,3
;
run;
proc format cntlin=fmt;
* in case you want to see the format you create ... use SELECT;
select $pr2grp;
run;
then use the format to assign a procedure to a group ...
prgroup = put(proc,$pr2grp.);
if the procedure codes are numeric in your data set, just make a numeric format
data fmt;
retain fmtname 'pr2grp';
infile datalines dsd;
input start end label : $1.;
datalines;
61106,61110,1
61230,61230,2
64550,64590,3
;
run;
proc format cntlin=fmt;
select pr2grp;
run;
if you want the group variable to be numeric, change the assignment statement
prgroup = input(put(proc,$pr2grp.),best.);;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> Hi,
> I need to categorize clinical procedure codes into larger procedure code
> categories. I downloaded a dataset of ranges of procedure codes that fall
> into 200 different categories.
>
> I am having trouble linking the procedure code grouping to the procedure
> code because the downloaded dataset gives a range of procedure codes. For
> instance, the fields are start, end, and proc_group. Examples of the
> values are:
> 61106,61110,1
> 61230,61230,2
> 64590,64550,3
>
> If the procedure code in my dataset is 61107, it would be grouped as
> proc_group=1. It follows that if the proc code is 61230, it would be
> assigned in proc_group=2, and so on.
>
> I need a SAS code (or SQL) to link the 2 datasets. Can anyone help with
> this? Thanks!
>
|