|
prasad_prabhud@hotmail.com wrote:
> I have following Patient Data with 5 months of data with 100mg drug,
> 150mg drug and 200mg drug.
>
> ID A100_1 A100_2 A100_3 A100_4 A100_5 A150_1 A150_2 A150_3 A150_4
> A150_5 A200_1 A200_2 A200_3 A200_4 A200_5
> 100 1 0 0 0 0 0 1 1 1
> 0 0 0 0 0 1
> 101 0 0 1 1 1 0 0 0 0
> 0 0 0 0 0 0
> 102 1 1 0 0 0 0 0 0 0
> 0 0 0 1 1 1
> 103 0 0 0 1 0 0 0 0 0
> 1 0 0 0 0 0
> 104 1 1 1 0 0 0 0 0 0
> 0 0 0 0 1 1
>
> What I want is the Pattern in which Patient has been on Drugs?
> Like Patient started with 100mg and has been on 100mg drug throughout
> 5 months or Patient started with different mg drug and then continued
> with 100mg drug.
>
> I would appreciate if anybody can help me in this.
Your one/zero states for the variables tells me you bit encode the drug
usage flags in an integer value ranging from 0 to 2*32-1.
Once you have a bitencoded value, you can test for various patterns using
bitmask tests;
data patients;
length id 8;
array A100_[5];
array A150_[5];
array A200_[5];
format _all_ 4.;
input
ID A100_1-A100_5 A150_1-A150_5 A200_1-A200_5;
cards;
100 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1
101 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0
102 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1
103 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0
104 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1
;
data tobitpatients;
set patients;
array A100_[5];
array A150_[5];
array A200_[5];
binarydigits = cats(of a:);
aencoded = input (binarydigits,binary32.);
format aencoded binary32.;
if aencoded = '.............11'b then
put id= ' experienced 200mg in month 4 and 5
drop binarydigits a100_: a150_: a200_:;
run;
--
Richard A. DeVenezia
http://www.devenezia.com/
|