Dear all,
I have a panel dataset for firm, year, and quarter observations. I need to compute the average of inventory from the current quarter and the prior quarter and use this average in my regression.
Cyear is calendar year, invtq is quarterly inventory
Thank you,
Rochelle
I have a panel dataset for firm, year, and quarter observations. I need to compute the average of inventory from the current quarter and the prior quarter and use this average in my regression.
- I do not know which function to use to extract quarter or if that is necessary
Cyear is calendar year, invtq is quarterly inventory
Code:
Example generated by -dataex-. For more info, type help dataex clear input str6 firmid long datadate str6 datacqtr double invtq float(cyear quarter) "002403" 18352 "2010Q1" 1284 2010 200 "002403" 18443 "2010Q2" 1265 2010 201 "002403" 18535 "2010Q3" 1369 2010 202 "002403" 18627 "2010Q4" 1204 2010 203 "002403" 18717 "2011Q1" 1322 2011 204 "002403" 18808 "2011Q2" 1492 2011 205 "002403" 18900 "2011Q3" 1357 2011 206 "002403" 18992 "2011Q4" 1384 2011 207 "002403" 19083 "2012Q1" 1463 2012 208 "002403" 19174 "2012Q2" 1521 2012 209 "002403" 19266 "2012Q3" 1697 2012 210 "002403" 19358 "2012Q4" 1657 2012 211 "005180" 18352 "2010Q1" 6312.82 2010 200 "005180" 18443 "2010Q2" 6083.429 2010 201 "005180" 18535 "2010Q3" 6408.808 2010 202 "005180" 18627 "2010Q4" 5905.91 2010 203 "005180" 18717 "2011Q1" 6475.368 2011 204 "005180" 18808 "2011Q2" 6862.216 2011 205 "005180" 18900 "2011Q3" 6304.284 2011 206 "005180" 18992 "2011Q4" 6017.48 2011 207 "005180" 19083 "2012Q1" 6406.789 2012 208 "005180" 19174 "2012Q2" 6210.087 2012 209 "005180" 19266 "2012Q3" 6510.875 2012 210 "005180" 19358 "2012Q4" 6454.388 2012 211
Rochelle
Comment