Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Data Management for Long Format of Complex Medical Data


From   TA Stat <[email protected]>
To   [email protected]
Subject   st: Data Management for Long Format of Complex Medical Data
Date   Sat, 14 Feb 2009 12:35:07 +0700

I have data arranged in the format that each row represents one drug
for a clinic visit. So, one patient may have more than one drug (row)
for each visit. Each patient also have several clinic visits.

There are 4 classes of drugs, called Class A, Class B, Class C and
Class D. Class A has four drugs, called A1, A2, A3 and A4. Class B has
3 drugs, called B1, B2, B3. so as Class C and Class D (as presented
below). Some combination of drugs is called GMMT, others are not. I
would like to find if each patient has received GMMT at each clinic
visit or not.

Drug Class:

- Class A: A1, A2, A3, A4
- Class B: B1, B2, B3
- Class C: C1, C2, C3
- Class D: D1, D2, D3, D4

a combination of drug is called GMMT if

- any combination from class A and class B
- any combination from class A and class C
- any combination from class A and class D
- any combination from class B and class C
- any combination from class A and class B and class C

(However, there are some exceptions)

- but not any combination from class C and class D
- but not a combination of A4 and B3


For example, from table 1 to table 2, I want to create a variable name "GMMT"
with the conditions explain earlier. So John received GMMT for visit 1,
visit 2, visit 4, but not visit 3.  Jen received GMMT at visit 1,
visit 2, visit 4, but not visit 3.

Although at visit 4 for Jen, a combination of A4 and B3 is not GMMT,
but she also received C4. So she received GMMT.  At visit 3 for John,
he received C1 and D1 (any combination of drug from Class C and Class
D), so he received GMMT.

In short, I want to know how to get Table 2 from Table 1. I can do
Table 2 to Table 3.

***************************************************************************************

Table 1

Name       Visit      Drug

John           1           A1
John           1           B1
John           1           C1
John           2           A1
John           2           B1
John           3           C1
John           3           D1
John           4           B2
John           4           C2
John           4           D1
Jen             1           B3
Jen             1           C3
Jen             1           D4
Jen             2           A4
Jen             2           B3
Jen             2           C3
Jen             2           D4
Jen             3           A4
Jen             3           B3
Jen             4           A4
Jen             4           B3
Jen             4           C4

***************************************************************************************

Table 2

Name       Visit      Drug        GMMT (Y=Yes, N=No)

John           1           A1            Y
John           1           B1            Y
John           1           C1            Y
John           2           A1            Y
John           2           B1            Y
John           3           C1            N
John           3           D1            N
John           4           B2            Y
John           4           C2            Y
John           4           D1            Y
Jen             1           B3            Y
Jen             1           C3            Y
Jen             1           D4            Y
Jen             2           A4            Y
Jen             2           B3            Y
Jen             2           C3            Y
Jen             2           D4            Y
Jen             3           A4            N
Jen             3           B3            N
Jen             4           A4            Y
Jen             4           B3            Y
Jen             4           C4            Y

***************************************************************************************

Table 3

Name       Visit      Drug        GMMT (Y=Yes, N=No)

John           1           A1            Y
John           2           A1            Y
John           3           C1            N
John           4           B2            Y
Jen             1           B3            Y
Jen             2           A4            Y
Jen             3           A4            N
Jen             4           A4            Y

***************************************************************************************

Thanks

Pete
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index