Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: reading data from ftp site?


From   [email protected] (Alan Riley)
To   [email protected]
Subject   Re: st: reading data from ftp site?
Date   Thu, 25 Jan 2007 12:08:46 -0600

Paulo Guimaraes ([email protected]) would like to download
data from an FTP site directly into Stata:
> I would like to know if it is possible to read data directly from an ftp
> site.
> My interest in this is because I need to access some flat files at the BLS
> web site.
> Right now what I do is to open the file in my web browser and then save it
> and insheet it into Stata.
> For example, to read the employment time series for the state of Alabama I
> need to open the file in my web browser
> with the command:
> ftp://ftp.bls.gov/pub/time.series/sm/sm.data.1.Alabama
> and then save it and read it into Stata.
> Is it possible to read the data directly from within Stata?


Anders Alexandersson ([email protected]) suggested that it may
be possible to do this directly in Stata:
> I don't think you need to resort to mapping. The user manual [U] 28.2
> suggests the Stata -copy- command for sharing other files than Stata
> datasets (for which -use- is a direct solution). Although the URL
> examples are for http, and I have not tried ftp, ftp is another type
> of URL so it should work.

Stata currently supports only the 'http' protocol for accessing files
on the internet.  URLs beginning with 'ftp://' and protocols other
than 'http://' are not supported.

Paulo should be able to do as Austin Nichols ([email protected])
suggested:
> There are probably several platform-specific approaches.  One is to
> "map an ftp server as a drive" or whatever the equivalent operation is
> in your OS.  In various flavors of Windows, there are several apps
> that can map a drive letter to an ftp server, at which point the
> standard infiling commands should work fine.

Depending on the operating system Paulo is using, command-line utilities
such as 'curl' or 'wget' may also be available which support downloading
data using a variety of protocols, including ftp.  Paulo could use Stata's
-shell- command to access such a command to download a file via ftp.


Alan
([email protected])
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index