Nick,
Thanks, I'm going with your first method with
reshape's. When I get to the line below marked
"********" I get an r(198) syntax error. What do I
have incorrect (I thought I had the semi-colons in the
right places)?
And with the last line where "countperiod > 0", that
will only subtract Z by 1 when the condition is met?
best,
cm
-------------------
use c:\temp\Book1 ;
reshape long var , i(id) j(num) string ;
bysort id var : gen Z = _n == 1 ;
by id : replace Z = sum(Z) ;
by id : replace Z = Z[_N] ;
reshape wide var , i(id) j(num) string ;
gen countperiod = 0 ;
foreach v of var1-var10 { ;
replace countperiod = countperiod + (`v' == ".") ;
} ; ********
replace Z = Z - (countperiod > 0) ;
*
* 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/