Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: programming problem


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   st: programming problem
Date   Thu, 16 Aug 2007 13:45:53 -0400

I have observations on patient admissions over
a 12 month period.

For each observation, I have 12 variables, call
them var1-var12, which indicate whether a certain
condition was met for that patient for months 1-12.
So, eg, it may be true for months 1-3 and 7-12.

I also have a variable -month-, which indicates
the current month of the observed admission. What
I want to capture is whether the condition was true
in the month of admission.

For instance, at first I unthinkingly tried this:

 gen mycond = var`=month'==1

but this of course uses the first observed value
of -month-, which happens to be 6, and only checks
-var6-.

I eventually got there by creating lots of vars, but is
there a more direct solution?

thanks,
Jeph



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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