Statalist


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

st: RE: re: generate trend variable in Stata


From   "Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: re: generate trend variable in Stata
Date   Wed, 26 Nov 2008 09:45:08 -0800

I was thinking that this might be a  rolling estimation problem, and
Maarten Buis commented about using the rolling command.  Depends on the
intent of the user.

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kit Baum
Sent: Tuesday, November 25, 2008 6:13 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: re: generate trend variable in Stata

<>
If I guess your intention correctly, -egen, group()- will do it.

Nick
n.j.cox@durham.ac.uk

Diana Eastman

I have a panel data set that has several repeating four-week ending
periods:

Example:
fourwk_ending
17 Aug 96
14 Sep 96
12 Oct 96
09 Nov 96
07 Dec 96
04 Jan 97
01 Feb 97
01 Mar 97
29 Mar 97
26 Apr 97
24 May 97
21 Jun 97


I want to create a variable "trend" that will assign a numeric value to
each four-week ending period. So 17 Aug 96 might be 1, etc.



  Why not just

bysort unit (fourwk_ending): gen t = _n


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index