This can be accomplished in a number of ways.
1) Use of the Expanded Form of the SAMPLE command to select only the ranges (months) needed.
e.g. to select each August, assuming the series begins with February
sample 7 7 19 19 31 31 43 43 55 55
and so on for as many observations as you need.
2) Via a SKIPIF command using a supplied month index
Read monthly observations along with a month index from a free format text file, skip all but the 8th month indicated by the index, produce summary statistics for the subset and finally graph the variable.
read (testdata.txt) month variable
3) Via a SKIPIF command using an index we generate
Read monthly observations from a free format text file, create a month index, skip all but the 8th month indicated by the index, produce summary statistics for the subset and finally graph the variable formatting the x axis to show the month counter.
* Assuming we have monthly observations stored in a free format text file
* where the 1st observation is a February. Counter is from 1...N.
read (testdata1.txt) variable
* Generate month index noting the data starts from February
* TIME(1) creates an index by adding 1 to each value.
* MOD(12,12) = 0 so replace all 0s with 12
if(month_ind.eq.0) month_ind = 12
* Create a time index for the graph axis and adjust for start of February
time 2007 12 months
genr month = lag(months,-1)
* Skip any observations we do not want to use in estimation or graphing
* Check basic statistics of the variable for just the 8th month
* Draw a Graph
* Use the TIMEFMT and AXISFMT commands to customise the X axis
* Plot against the corrected month index
graph variable month / timefmt axisfmt line
The output from this is:
NAME N MEAN ST. DEV VARIANCE MINIMUM MAXIMUM
VARIABLE 4 0.16307E+08 0.15739E+08 0.24772E+15 0.11308E+06 0.36045E+08
The graph produced was:
The data file used in this was: