Statalist


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

Re: st: event history analysis for multiple response and repeated events


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   Re: st: event history analysis for multiple response and repeated events
Date   Fri, 6 Mar 2009 22:32:14 +0100

<>

Try section 5.1 of http://www.stata-journal.com/sjpdf.html?articlenum=pr0016

You do not need a loop. -replace- works on the whole vector of observations and applies your -if- statement to every one of them :-)

HTH
Martin
_______________________
----- Original Message ----- From: "fernando andrade" <[email protected]>
To: <[email protected]>
Sent: Friday, March 06, 2009 10:27 PM
Subject: Re: st: event history analysis for multiple response and repeated events


thank you, but is there a loop to do it  without attaching it to the
other conditions?


On Fri, Mar 6, 2009 at 4:22 PM, Martin Weiss <[email protected]> wrote:
<>

Attach the "if cnt==484" to the other conditions. The way it is set up now
it checks for the first observation only...

HTH
Martin
_______________________
----- Original Message ----- From: "fernando andrade"
<[email protected]>
To: <[email protected]>
Sent: Friday, March 06, 2009 10:19 PM
Subject: Re: st: event history analysis for multiple response and repeated
events


Hi
i am new using stata, i am having problems with this simple loop uisng if.

gen grade=.

if cnt==484{
replace grade = 1 if SC04Q01 == 1 & SC04Q02 == 1 & SC04Q03 == 1 &
SC04Q04 == 1 & SC04Q05 == 1 & SC04Q06 == 1 & SC04Q07 == 0 & SC04Q08 ==
0 & SC04Q09 == 0 & SC04Q10 == 0 &/// SC04Q11 == 0 & SC04Q12 == 0
replace grade = 2 if SC04Q01 == 0 & SC04Q02 == 0 & SC04Q03 == 0 &
SC04Q04 == 0 & SC04Q05 == 0 & SC04Q06 == 0 & SC04Q07 == 1 & SC04Q08 ==
1 & SC04Q09 == 1 & SC04Q10 == 0 &/// SC04Q11 == 0 & SC04Q12 == 0
replace grade = 3 if SC04Q01 == 0 & SC04Q02 == 0 & SC04Q03 == 0 &
SC04Q04 == 0 & SC04Q05 == 0 & SC04Q06 == 0 & SC04Q07 == 0 & SC04Q08 ==
0 & SC04Q09 == 0 & SC04Q10 == 1 &/// SC04Q11 == 1 & SC04Q12 == 1
}

the replace commands work well without the loop, it makes the
transformations in all the data set.
but i want to restrict the transformations to only those who have a
value of 484 in cnt.

any ideas why the loop is not working

thank you very much
fernando
*
* 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/


*
* 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/


*
*   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/


*
*   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