Dear all,
Recently I've encountered the following behaviour while running the following script (Allin, you maybe recognize that
this is a slightly modified version of the script you provided in one of the previous messages):
-------------- Start script ---------------------------------------------
# Select full sample
smpl full
# start a loop in which for each loop a different,
# successive month is selected, going from Jan 1981 till Dec 2007
loop j=1981:01..2007:12
# Select a sample of 1 month
smpl $j $j
list OKstocks = null
# For each stock in each year, check whether the
# following conditions are fulfilled
loop foreach i AALBERTS..ZEELAND_
n = sum(ok($i))
if n==1
OKstocks = OKstocks $i
endif
endloop
if nelem(OKstocks) > 0
smpl $j
# save each valid stock to a database, with name reflecting
# the year of the check
store --csv "/tmp/04042011/some_name_$j.csv" OKstocks --omit-obs
endif
endloop
---------------- End script --------------------------------------------
Basically each time a single month is supposed to be selected, starting from January 1981, however, when
I look at the output of the script, I see the following:
--------------- Start output ---------------------------------------------
loop: j = 1981:01
? smpl 1981:02 1981:02
Full data range: 1981:01 - 2007:12 (n = 324)
Current sample: 1981:02 - 1981:02 (n = 1)
:
:
:
store: using filename /tmp/04042011/some_name_1981:02.csv
Data written OK.
loop: j = 1981:02
------------------ End output -------------------------------------------
My question is why does it start from Feb 1981 instead of Jan 1981? This creates a problem with the
last observation:
---------- Start output -----------------------
? smpl 2008:01 2008:01
Observation number out of bounds
error in new starting obs
----------- End output ------------------------
While, in fact, this should be the observation for Dec 2007.
Also, if you look at the bottom of the script, the argument "--omit-obs" is placed after
the name of the file, because if I put it after "store --csv" it flags an error:
field '"' in command is invalid
I use gretl version 1.9.3 on Ubuntu (10.10).
Thank you in advance for your help and for creating a great piece of software.
---------------------------------------
Sergey