Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: a question on how to create a complex loop


From   Aluko Hope <[email protected]>
To   [email protected]
Subject   st: a question on how to create a complex loop
Date   Wed, 8 Feb 2012 11:00:53 -0500

Dear Stata list users,

I am a health services researcher who is relatively new to STATA and I
am trying to count the number of times each patient satisfies a
particular criteria. I think I need to do this by creating a complex
loop but I am stuck as to how to go about it.

The data is structured in the following manner:

id diag1 diag2 diag3 visit# diagcateg1
1    icd    icd    icd      3      1
1    icd    icd    icd      3      1
1    icd    icd    icd       3      1
2    icd     icd   icd       4       0
2    icd    icd    icd       4       0
2    icd    icd    icd       4       0
2    icd    icd    icd       4       0
3    icd    icd    icd       2       1
3    icd    icd    icd      2        1

the icd refer to really icd9 and the diagcateg1 is a binary variable
that already classifies certain icd9 into categories.

in words, what i want to do now is:
whenever diagcategory is 1, count the number of times per patient (id)
that there is a diag1 diag2 or diag3 that fit a particular criteria. i
would be happy with the total number per patient but would ideally
like to be able to describe the total number per patient per visit.

Please help,

Many thanks in advance,

Aluko Hope
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index