Am 04.02.2011 18:36, schrieb Allin Cottrell: > On Thu, 3 Feb 2011, Leon Unger wrote: > >> Am 31.01.2011 21:43, schrieb Allin Cottrell: >>> string Q = "SELECT country,year,y FROM FooBase" >>> data y obs-format="%s:%d" query=Q --odbc >>> >>> This should work if the "country" variable contains string >>> country-codes such as "FRA", "GER", etc., and the year variable >>> contains years as integers: >>> >>> GER:1990 123.5 >>> GER:1991 127.6 >>> >>> This assumes that the pre-existing gretl dataset has observation >>> strings on the pattern shown above. >> I created an empty panel dataset with appropriate obs:time >> combinations and then used the GUI to read in the oberservation >> markers from a txt file. I know how to create the 'normal' empty >> panel via script, but how can I get the markers directly from >> script? > Well, you could do something like this: > > <script> > scalar N = 3 > scalar T = 10 > scalar yr0 = 1990 > > string s1 = "FRA" > string s2 = "GER" > string s3 = "GBR" > > set echo off > outfile markers.txt --write > loop i=1..N --quiet > loop j=1..T --quiet > printf "%s:%d\n", s$i, yr0+j-1 > endloop > endloop > outfile --close > </script> > > That will give you a file containing the observation markers. You > can add these to a dataset using the GUI ( /Data/Observation > markers ), or, if you use the latest snapshot from > http://gretl.sourceforge.net/win32/ , you can add the markers > via script using a new option to "setobs", as in > > <script continues> > scalar NT = N*T > nulldata NT --preserve > setobs T 1:01 --stacked-time-series > setobs --labels=markers.txt > </script> > > Allin Cottrell > > > _______________________________________________ > Gretl-users mailing list > Gretl-users(a)lists.wfu.edu > http://lists.wfu.edu/mailman/listinfo/gretl-users Hi there,
wow, that's really nice! I tried it and it works fine with a slight modification in the setobs command: scalar NT = N*T nulldata NT --preserve setobs T 1:01 --stacked-time-series *setobs --labels=C:\Users\Pindar\Documents\gretl\GRETL\markers.txt* If I don't give GRETL the path, it does not find 'markers.txt' although it's in the default location. Have a nice weekend Pindar
Am 04.02.2011 18:36, schrieb Allin Cottrell:
Hi there,On Thu, 3 Feb 2011, Leon Unger wrote:Am 31.01.2011 21:43, schrieb Allin Cottrell:string Q = "SELECT country,year,y FROM FooBase" data y obs-format="%s:%d" query=Q --odbc This should work if the "country" variable contains string country-codes such as "FRA", "GER", etc., and the year variable contains years as integers: GER:1990 123.5 GER:1991 127.6 This assumes that the pre-existing gretl dataset has observation strings on the pattern shown above.I created an empty panel dataset with appropriate obs:time combinations and then used the GUI to read in the oberservation markers from a txt file. I know how to create the 'normal' empty panel via script, but how can I get the markers directly from script?Well, you could do something like this: <script> scalar N = 3 scalar T = 10 scalar yr0 = 1990 string s1 = "FRA" string s2 = "GER" string s3 = "GBR" set echo off outfile markers.txt --write loop i=1..N --quiet loop j=1..T --quiet printf "%s:%d\n", s$i, yr0+j-1 endloop endloop outfile --close </script> That will give you a file containing the observation markers. You can add these to a dataset using the GUI ( /Data/Observation markers ), or, if you use the latest snapshot from http://gretl.sourceforge.net/win32/ , you can add the markers via script using a new option to "setobs", as in <script continues> scalar NT = N*T nulldata NT --preserve setobs T 1:01 --stacked-time-series setobs --labels=markers.txt </script> Allin Cottrell _______________________________________________ Gretl-users mailing list gretl-us...@lists.wfu.edu http://lists.wfu.edu/mailman/listinfo/gretl-users wow, that's really nice! I tried it and it works fine with a slight modification in the setobs command: scalar NT = N*T nulldata NT --preserve setobs T 1:01 --stacked-time-series setobs --labels=C:\Users\Pindar\Documents\gretl\GRETL\markers.txt If I don't give GRETL the path, it does not find 'markers.txt' although it's in the default location. Have a nice weekend Pindar |