Hi
I have variables for the year, the quarter (taking values from 1 to 4), and the week (taking values from 1 to 12 within the quarter).
I want to create a date variable with the format yearquarterweek (e.g., 2012q1w1) noting that q will be from 1 to 4 and w will be from 1 to 12 within the quarter.
I also have a date variable daymonthyear (e.g., 12nov2015). I tried
However, this will generate a weekly_date variable in which the weeks are taking values from 1 to 52 within the year (so not as I wanted) and also the weeks are state weeks which are different from the weeks I have.
I look forward to getting some help
Thanks
I have variables for the year, the quarter (taking values from 1 to 4), and the week (taking values from 1 to 12 within the quarter).
I want to create a date variable with the format yearquarterweek (e.g., 2012q1w1) noting that q will be from 1 to 4 and w will be from 1 to 12 within the quarter.
I also have a date variable daymonthyear (e.g., 12nov2015). I tried
Code:
gen weekly_date = wofd(date) format weekly_date %tw
I look forward to getting some help
Thanks
Comment