Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Import Data from Google Insights for Search to stata


From   Stas Kolenikov <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Import Data from Google Insights for Search to stata
Date   Sun, 22 Jan 2012 11:37:49 -0500

While -use- or -infile- do not care whether you open a local file or a
remote file over http, I don't see any obvious way to supply the
username/password. You would probably have to use an intermediate
layer to download the report.csv and open it locally using say GNU's
wget:

foreach q in stata sas spss {
  capture erase report_`q'.csv
  !wget -O report_`q'.csv --user=blah --password=blahblah
http://www.google.com/insights/search/overviewReport?cat=0-174&q=`q'&cmpt=q&content=1&export=1
  insheet <you need to know what the expected variables are> using
report_`q'.csv, clear
  save insight_`q', replace
}

I am sure the above won't run, but this may serve as a starting point :).

If you know http protocol in and out, you can write everything using
-file- commands (in Stata or Mata), although that will probably be a
lot of pain.

On Sun, Jan 22, 2012 at 10:52 AM, Ulrich Brandt
<Ulrich.Brandt2@wiso.uni-hamburg.de> wrote:
> Hey,
>
> i am working on a paper where i want to use data downloaded from "Google
> Insights for Search" in Stata.
> It is possible to download a .csv File with the results when you log in with
> your google account.
> My question is if it is possible to automate login, search and data entry
> and download of the .csv file in Stata?
>
> Unfortunately at the moment there is no API for Google Insights for Search
> yet.
> I found some examples of a
> - R package
> http://www.stanford.edu/~knoepfle/cgi-bin/flatpress/?x=entry:entry101220-023915
> and an
> - C# example
> http://stackoverflow.com/questions/1656446/download-csv-from-google-insight-for-search
> for solving my problem.
> Do you think it is possible to program something like that in Stata or Mata?
>
> Thank You and best Regards
> Ulrich Brandt
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/



-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index