importing flat file from ftp

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Moderator, EViews Jason, EViews Gareth, EViews Steve, EViews Pamela

importing flat file from ftp

Postby nlf on Thu Jul 29, 2010 8:00 am

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
nlf
 
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am

Re: importing flat file from ftp

Postby tchaithonov on Thu Jul 29, 2010 9:18 am

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.
tchaithonov
 
Posts: 102
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: importing flat file from ftp

Postby EViews Jason on Thu Jul 29, 2010 9:25 am

In the data, 'M13' is listed as a period value. How do you wish to handle the observations for those periods?
EViews Jason
EViews Developer
 
Posts: 107
Joined: Tue Sep 16, 2008 3:50 pm

Re: importing flat file from ftp

Postby EViews Jason on Thu Jul 29, 2010 9:46 am

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
EViews Jason
EViews Developer
 
Posts: 107
Joined: Tue Sep 16, 2008 3:50 pm

Re: importing flat file from ftp

Postby nlf on Thu Jul 29, 2010 1:30 pm

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.
nlf
 
Posts: 8
Joined: Mon Jul 26, 2010 9:13 am


Return to Data Manipulation

Who is online

Users browsing this forum: No registered users and 1 guest