Hi, I have observations with a start date and an end date (e.g. 04/31/1997 and 02/19/2002) and I want to create a dummy variable for each year (and fraction thereof) between each observations start and end date. In practice, I also want the year to begin on April 1st rather than Jan 1st.
For example, converting the above dates into dummy variables indicated with ‘1’ for 1997,1998,1999,2000,2001 and ‘0’ for other years in the dataset - note that 2002 isn't include because it doesn't include my start of the year = April 1st). Does that makes sense? Any ideas on how I could code this/
Cheers
Related Posts with Converting a start and end date (a timeframe) into several annual time dummies
competing risk without covariatesI want to compare the risk of dying of a specific cancer versus "other causes" in a large sample. Co…
invalid variable nameHi! I am trying to reshape my data.
id Co base ID3
103 0 0 103_6_6
104 0 1 104_0_0
104 0 0 104_1_1
…
Econometrics questions : Functional form choiceHi statalist,
I try to estimate the effect of a monetary bonus on physicians’ activity.
I would lik…
reg i.id i.year,vce(cl id) vs. xtreg i.year,fe rDear all,
We know "reg i.id i.year,vce(cl id)" is the same as "xtreg i.year,fe r",but why are the re…
Replace missing values smartlyHi all,
I am writing since I have a potentially simple task which however I am not able to figure o…
Subscribe to:
Post Comments (Atom)
0 Response to Converting a start and end date (a timeframe) into several annual time dummies
Post a Comment