Hi,
I want to generate two new date variables, one that is identical to another and another one which is 11 months earlier.
I have a variable called datadate which basically corresponds to the end of the fiscal year date.
Now, I want to generate a variable called endfyr which is equal to datadate.... Moreover, I want to generate a variable called begfyr which is the beginning of fiscal year, 11 months prior to endfyr.
My dates in stata are listed as date.month.year: datadate=31dec2004. I have a code that is used for SAS programming, so it doesn't directly translate to stata, but want something equivalent.
* create begin and end dates for fiscal year;
endfyr= datadate; format endfyr date9.;
begfyr= intnx('month',endfyr,-11,'beg'); format begfyr date9.;
*intnx(interval, from, n, 'alignment'); Could someone help me with the codes for stata?
Best,
Emilie
I want to generate two new date variables, one that is identical to another and another one which is 11 months earlier.
I have a variable called datadate which basically corresponds to the end of the fiscal year date.
Now, I want to generate a variable called endfyr which is equal to datadate.... Moreover, I want to generate a variable called begfyr which is the beginning of fiscal year, 11 months prior to endfyr.
My dates in stata are listed as date.month.year: datadate=31dec2004. I have a code that is used for SAS programming, so it doesn't directly translate to stata, but want something equivalent.
gvkey | fyear | datadate |
1004 | 1990 | 31may1991 |
1004 | 1991 | 31may1992 |
1013 | 1994 | 31oct1994 |
1013 | 1995 | 31oct1995 |
* create begin and end dates for fiscal year;
endfyr= datadate; format endfyr date9.;
begfyr= intnx('month',endfyr,-11,'beg'); format begfyr date9.;
*intnx(interval, from, n, 'alignment'); Could someone help me with the codes for stata?
Best,
Emilie
Comment