Date: Tue, 26 Jul 2011 13:49:29 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: identifying only the ICD 9 E codes in set of 15
In-Reply-To: <201107261824.p6QFgVuW019235@waikiki.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
You just need to keep a separate index for the E array.
data diag;
infile cards missover;
input (Diagnosis_Primary Diagnosis_2-Diagnosis_15) (:$8.);
cards;
9945 E927 E8490 27651 7802 4019 2729
87343 9190 E8809 E8496 71690
92411 E9179 E8490 V4365 33818 71946
92320 E8889 E8490 25000 4019 412 V5861
8730 95901 V037 E9174 E8490
84500 8449 E927 E8490 25000
920 7802 E8859 E8498 4019 2729
92311 92401 V037 E8859 E8495 25000 4019 V5867
30000 88102 311 E956 E8490
9100 E8889 E8490 4019 2948 V5861 V1254
8820 E9208 E8490 3332
8261 V065 E916 E8490
8822 V065 E9203 E8490 4019 2729 4279
84500 E9289 E8490 4019 2469
82525 E9170 E8494 4019 53081 2729 20280
94405 94800 E9241 E8490
82535 E9174 E916 E8493 V065
72402 7244 71945 4439 3051 60000 2859 78321 42789 490 78900 56400
49120 73730 E8844
92401 5990 78830 4019 2948 2662 E8859 E8497 V145 V4364 V4365 V1005
V1581
72888 4019 2724 71536 2948 30000 3899 92411 E8859 E8490 V5866
V4364
;;;;
run;
proc print;
run;
*** Let's assume E means ICD 9 E;
data diag;
set diag;
array d[*] Diagnosis:;
array e[*] $8 ecode1-ecode8;
j = 0;
do i = 1 to dim(d);
if d[i] eq: 'E' then do;
if not whichC(d[i],of e[*]) then do; *no dups;
j + 1;
e[j] = d[i];
end;
end;
end;
drop i j;
run;
proc print;
run;
On Tue, Jul 26, 2011 at 1:24 PM, BJ Mattson <bj.mattson@odh.ohio.gov> wrote:
> Toby
>
> I had't ever used the IFC function, so thank you for demonstrating it. Much
> more elegant than the kludge I worked out.
>
> Your code works except I need to have any existing E codes begining in
> ecode1 and filling in consecutively (ecode2, then ecode3, etc) so there are
> no skips.
>
|