Statalist


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

st: generate a varaible from date


From   "21443017" <[email protected]>
To   <[email protected]>
Subject   st: generate a varaible from date
Date   Tue, 4 Aug 2009 11:03:59 +0100

Dear All,

I am sorry for send the message several times, the format of the table
always change. Below is the correct one. 

How do I generate a variable which equals 1 for the first month the company
enters the dataset, equals 2 for the second month the company enters the
dataset etc...
 
It is an unbalanced panel, so every company starts from a different date.

I have an example of the dataset below,

id          date              date_s         variable
1          01-03-1965        -1138           1
1          01-04-1965        -1137           2
1          01-05-1965        -1136           3
1          01-06-1965        -1135           4
1          01-07-1965        -1134           5
1          01-08-1965        -1133           6
1          01-09-1965        -1132           7
1          01-10-1965        -1131           8
2          01-03-1959        -1210           1
2          01-04-1959        -1209           2
2          01-05-1959        -1208           3
2          01-06-1959        -1207           4
2          01-07-1959        -1206           5
2          01-08-1959        -1205           6
2          01-09-1959        -1204           7
2          01-10-1959        -1203           8
2          01-11-1959        -1202           9
2          01-12-1959        -1201          10


?Variable? is the variable that I want to generate from the date.


Many Thanks for your help.


Best Wishes

Wenwen 



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