Statalist The Stata Listserver

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

st: data management

From   "Carole J. Wilson" <>
Subject   st: data management
Date   Mon, 26 Mar 2007 12:13:55 -0500


You should edit the temp2 line in the loop to read:

gen temp2=1 if entry<exit[`i'] & exit>exit[`i']

if you want to exclude have cases of 6's that enter after `i' and exit
before `i'.  Again you may wish ">=" depending on how you wish to deal
with exits that occur in the same time period as `i'.


gen temp1=(size==6)
gen new=.
local n=_N
qui forvalues i = 1/ `n'  {
       capture drop temp2
       capture drop temp3
       gen temp2=1 if entry<exit[`i']
       egen temp3=sum(temp1) if temp2==1
       replace new=temp3 in `i'
*   For searches and help try:

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