options crt; name doquart 'DO loop over time periods with Quarterly Data'; ? ? This is an example of using a DO loop with a Quarterly frequency ? (for forecasting). The data has been omitted. ? The main trick is to use a time trend variable T (which runs ? from 1 to TMAX) to SELECT the subperiods required. ? Insert the largest SMPL used for estimation and forecasting below. ? TSP 4.2B (May 1994) ? Author: Clint Cummins ? freq q; smpl 77:4 95:3; ? maximum SMPL copy @smpl smplmax; trend t; set tmax = @nob; ? ? Insert the SMPL for forecasting below. ? Then the variables TFORMIN and TFORMAX will control the DO loop. ? smpl 94:1 95:3; ? forecasting SMPL copy @smpl smplfor; fdltrans = 0; ? initialize variables to full length dltrans = 0; ltrans = 0; resfit = 0; msd(noprint) t; set tformin = @min; set tformax = @max; smpl smplmax; ? reset to the maximum SMPL, so that all SELECTs will ? work relative to this. resfit = res2; ? DO tfor = tformin , tformax; ? ? error-correction model ?smpl 77:4 93:4; select t < tfor; ? use data up to one period before forecast olsq dltrans d1navmr d3dukhp dltrans(-2) dltrans(-4) dunemp resfit(-1) dst; ? forecasting ltrans for 94:1; ?smpl 93:4 94:1; select (t = tfor-1) .or. (t = tfor); ? forecast 2 periods forcst(print,static) fdltrans; ?smpl 94:1 94:1; select (t = tfor); ? update variables in forecast period genr ltrans=ltrans(-1)+fdltrans; genr dltrans=ltrans-ltrans(-1); genr resfit=ltrans-ltransfit; ENDDO; smpl smplfor; ? output results ?smpl 94:1 95:3; write(file='trans2.wk1') ltrans ltransfit fdltrans resfit; stop; end;