FOR loops and @month headache
Posted: Thu May 26, 2016 9:02 pm
Appreciate the help I've been getting, but have it a new snag.
Series M is the date of each observation. E.g. 1993-08-26
I can't seem to figure out a way to extract just the month from this series, in a 1 to 12 format. Which I can use in the following FOR/NEXT loop.
(The actual year part in loop runs smoothly. It's just when I try creating a month control variable the loop fails- I get NA values instead).
for !year= 1993 to 2001
smpl if yr = !year
for !month= 1 to 12
smpl if M=!month
series Q1=@sumsby(q, collector_ser)
next
next
TIA, B
Series M is the date of each observation. E.g. 1993-08-26
I can't seem to figure out a way to extract just the month from this series, in a 1 to 12 format. Which I can use in the following FOR/NEXT loop.
(The actual year part in loop runs smoothly. It's just when I try creating a month control variable the loop fails- I get NA values instead).
for !year= 1993 to 2001
smpl if yr = !year
for !month= 1 to 12
smpl if M=!month
series Q1=@sumsby(q, collector_ser)
next
next
TIA, B