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
Date formatHello, In the dataset, the date is in format : Code: 2015 - 07 - 01 00:00:00 2016 - 01 - 01 00:00…
Rename after reshape long to wideHi, I changed the data format from long to wide (variable 'binary') and the data is in form: Code…
Stata 16: Is it not possible to have BOTH the 'Variables' and 'History' windows be visible?It's a minor inconvenience--and perhaps I'll get used to it--but I still like how earlier versions o…
filling in missing values backwards based on growth rateDear all, I am currently working with a country-year panel data set where I have employment shares …
fastreshape resultsI've been reshaping an entire electoral roll (over 3 million entries) to get up to 12 flatmates in S…
Subscribe to:
Post Comments (Atom)
0 Response to Converting a start and end date (a timeframe) into several annual time dummies
Post a Comment