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

Re: st: Year to start 1st April


From   Nick Winter <nw53@cornell.edu>
To   statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu
Subject   Re: st: Year to start 1st April
Date   Sun, 07 Mar 2004 15:46:14 -0500

At 11:20 PM 3/5/2004 -0500, Richard Williams wrote:
Whoops. I think the original solution I posted quickly gets off a day. I think it is fixable, but how about this instead:

. gen finyear = year(datevisit)

. replace finyear = finyear - 1 if month(datevisit) < 4
Just a quick note to note, as it were, that this approach can be done in one line:

. gen finyear = year(datevisit) - (month(datevisit)<4)

(This works because the logical condition will evaluate to 0 or 1, as appropriate.

--Nick Winter


--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government nw53@cornell.edu e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601
*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index