Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Re: programming advice


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   RE: st: Re: programming advice
Date   Fri, 17 Dec 2004 04:45:55 -0600

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Dimitriy V. Masterov
> Sent: Friday, December 17, 2004 4:44 AM
> To: [email protected]
> Subject: Re: st: Re: programming advice
> 
> I am not sure if I understand your problem correctly, but is this
> what you have in mind?
> 
> gen x0=.
> bys code1: replace x0=x1 if month==0
> bys code1: replace x0=sum(x0)
> 
> 

Another way is:

bysort code (month): gen x0 = x1[1]

Scott



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