Page 1 of 1

importing flat file from ftp

Posted: Thu Jul 29, 2010 8:00 am
by nlf
Hi,

I would like to import data from the BLS ftp site into eviews but I don't know how to transpose the data to get it in to a monthly workfile.
the ftp is ftp://ftp.bls.gov/pub/time.series/sm/sm.data.9.dc

Below is a sample of the ftp file. When the data gets to the end of the time frame (2010 m06), a new series begins.
series_id year period value footnote_codes
SMS11000000000000001 1990 M01 687.8
SMS11000000000000001 1990 M02 689.6
SMS11000000000000001 1990 M03 691.4

If there is another source for not-seasonally adjusted state and metro employment data, I'd be interested in that too. FRED only has seasonally adjusted.

Thanks,

Norton

Re: importing flat file from ftp

Posted: Thu Jul 29, 2010 9:18 am
by tchaithonov
How about importing it into Excel and do text-to-column? I am not sure if you have a lot of files or not but if it's just one, this should be the fastest method.

Re: importing flat file from ftp

Posted: Thu Jul 29, 2010 9:25 am
by EViews Jason
In the data, 'M13' is listed as a period value. How do you wish to handle the observations for those periods?

Re: importing flat file from ftp

Posted: Thu Jul 29, 2010 9:46 am
by EViews Jason
This will get you most of the way there ignoring the M13 issue.

Code: Select all

wfopen "ftp://ftp.bls.gov/pub/time.series/sm/sm.data.9.dc" colhead=1 firstobs=1 alpha serid = @replace(series_id,"00","") 'shorten series names otherwise unstacking will complain about the names being too long alpha date = @str(year) + " " + period pageunstack(namepat="?*") serid date @ value

Re: importing flat file from ftp

Posted: Thu Jul 29, 2010 1:30 pm
by nlf
Thanks for the code. I think I can work through the M13 issue new that I can pull it in. The M13 is the annual data but they appear to be NAs so it should be easy to cycle through.