Months s
-
Login or Register
- Log in with
* Example generated by -dataex-. For more info, type help dataex clear input long mci float(month yr ref_this_month) 526 1 2018 0 526 2 2018 1 526 3 2018 0 526 4 2018 0 526 5 2018 0 end
// FIRST CREATE A STATA INTERNAL FORMAT MONTHLY DATE VARIABLE gen int mdate = ym(yr, month) format mdate %tm // IDENTIFY MONTH OF FIRST REFERENCE by mci (mdate), sort: egen int month_first_ref = min(cond(ref_this_month, mdate, .)) format month_first_ref %tm // CALCULATE TIME TO OR SINCE MONTH FIRST REF gen wanted = mdate - month_first_ref
Comment