On Tue, 27 May 2014, Sven Schreiber wrote:
Am 27.05.2014 02:56, schrieb Allin Cottrell:
> I see that Stata has infinite patience with silly-buggers column
> headings and in CVS I've made a move in that direction. But I need
> to rant just a little: I suppose the data are carefully done, but
> the column headings look as if they've been added by a total
> computer illiterate with the attitude "I don't care; if anyone
> really wants to make sense of this they'll find a way".
Rant granted. But OTOH I think one has to concede that with this stuff
Excel sets a kind of standard that people come to expect of other
software as well. It's like blanks in file names; I hate them and try to
educate others to hate them as well, but in practice on Windows one has
to admit that they usually just work.
Sigh. But yes, you're right.
> Anyway, you can get [the Maddison data] to appear as annual data
in
> gretl as follows. [...]
I really appreciate your efforts, you really don't have to provide
tailor-made solutions to questions like these. When I report these
problems it's to extend gretl in the future, not (usually) to get the
work done for me.
Thanks, I understand. But I wasn't aiming to "do your work for you" so
much as show that it could be done in hansl, if not exactly conveniently
then without extreme measures such as inserting hundreds of blank rows in
the source file.
Anyway, I've now generalized the more automated handling of bad column
headings to the spreadsheet importers, so this will now work "out of the
box":
open mpd_2013-01.xlsx --rowoffset=2
Since the first column heading is blank the years come in as observation
markers. To get the years as a series one could insert a heading such as
"datayear" in the first column and reopen the data file, or -- showcasing
"introspection" via hansl's string-handling:
<hansl>
markers --to-file=markers.txt
string s = readfile("markers.txt")
matrix yearvec
sscanf(s, "%m", yearvec)
series year = yearvec
</hansl>
Allin