Code:
clear input str20 DATESTR double SALES GDP byte SELECT "2019m1" 1243 209 0 "2019m2" 889 209 0 "2019m3" 1220 210 0 "2019m4" 1594 211 0 "2019m5" 1458 212 0 "2019m6" 1178 213 0 "2019m7" 1452 214 0 "2019m8" 1453 214 1 "2019m9" 1281 215 1 "2019m10" 1444 216 1 "2019m11" 1185 216 1 "2019m12" 1194 217 1 "2020m1" 1255 216 1 "2020m2" 1029 216 1 "2020m3" 1290 215 1 "2020m4" 674 208 1 "2020m5" 1014 201 1 "2020m6" 1757 195 1 "2020m7" 1826 200 1 "2020m8" 1563 206 1 "2020m9" 1483 211 1 "2020m10" 1388 213 1 "2020m11" 1288 214 0 "2020m12" 1321 215 0 "2021m1" 1301 217 0 "2021m2" 1211 219 0 "2021m3" 1698 220 0 "2021m4" 2027 223 0 "2021m5" 1715 225 0 "2021m6" 1746 227 0 "2021m7" 1790 229 0 "2021m8" 1803 230 0 "2021m9" 1535 232 0 "2021m10" 1503 235 0 "2021m11" 1549 237 0 "2021m12" 1401 240 0 "2022m1" 1350 241 0 "2022m2" 1238 243 0 "2022m3" 1809 244 0 "2022m4" 1929 246 0 "2022m5" 1612 247 0 "2022m6" 1690 249 0 end gen date=monthly(DATESTR,"YM") tsset date, m mkmat SALES GDP if SELECT==1, matrix(goodmatrix) rown(date)
NOTE: I must use the time variable 'date' variable to accomplish this, I cannot use 'DATESTR'.
0 Response to Selectively list date variable as matrix row name using macro
Post a Comment