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

Re: st: A query on handling monthly data


From   austin nichols <[email protected]>
To   [email protected]
Subject   Re: st: A query on handling monthly data
Date   Tue, 10 Jan 2006 08:20:56 -0500

1. Given existing variables year and month,
. gen newdate=(year-1960)*12+month-1
. format newdate %tm

2. I assume you mean panel, i.e. you want the initial value for some
variable, say agehead, for each household (each cross-section means
looking over all households at a given point in time), and I assume
you have a household ID.
. bys hhid (newdate): gen init_agehead=agehead[1]

See -fillin- for  how to fill in the missing zero values you describe
in the first paragraph below.

On 1/10/06, Badri Narayanan Gopalakrishnan <[email protected]> wrote:
> Dear Statalist users and experts,
> My dataset consists of monthly data of about 12000 households for 10
> years, some of which are repeating and others are not. Data for all
> months is not available, ie, for many months, there is no observation.
> On an average, each year has data for 4 months. Though it's understood
> that values are zero for non-reported months, I have't created extra
> observations and filled-in zeros. Thus the monthly data is not in
> regular intervals,i.e., this is with gaps.
>
> Now, I need to do the following things with my dataset:
> 1. Create a timeid for each month, which is of stata-compatible form,
> say, 1994m1,....  I have a variable for year and one for month, both
> are integers.
>
> 2. Do tsset and then define a variable that takes, throughout, the
> value of the first observation of each cross-section  of an existing
> variable. This observation-number is not the same for most
> cross-sections, as data for different crosssections may start in
> different times!.
>
> Though both of these problems seemed trivial to me before, I could not
> do much and hence I really need your help to proceed further, atleast
> for the problem 1.
>
> Thanking you in anticipation.
>
> Regards,
> Badri Narayanan G.,
>
> *
> *   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/
>

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