Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: run STATA DO files on web?

From   <>
To   "STATA list post" <>
Subject   Re: st: run STATA DO files on web?
Date   Thu, 04 Mar 2010 17:31:59 +0000

Thanks to those, in particular Eric Booth, who responded to this.
In short, it seems that my problem is more with Google groups than with STATA.  
For those interested, it seems that Google groups has rather inconsistent behaviour when opening a file in a new browser.  I find that sometimes the resulting URL ends with the original filename, sometimes it is suffixed with '?gsc=' and sometimes with '?gda='.  The 'gda' links seem to work fine when supplied to DO, but the others don't.  
I haven't yet found how to force the 'gda' behaviour, or get the relevant information another way, but for now I think I've got a workable solution.
Date: Wed, 3 Mar 2010 22:13:32 -0600
From: Eric Booth <>
Subject: Re: st: run STATA DO files on web?
The problem is that google groups redirects your browser twice when you click the link for a file stored on google groups.  If you file is located at:   it redirects to because this is the way that googlegroups stores its files.   Then that link redirects to a permanent location with a really long link.  This last file is the only one you can directly with the -do- or -type- command, the first two files have all the html code that causes Stata to choke.  
For example, I uploaded a file called "" to the google group for Stata users at 
If I simply use the link for "", here's the error I get:
file not found
server says file permanently redirected to 
> .do
So, this gives me the redirect location.  
If I put that location into my command, it will show me all the html code that stata can't interpret...I guess you could write a program that scrubs this from the file before running it, but that seems like a pain:
type "";
*this gives me all the html code*
do "";
**this gives the error below because stata doesnt understand the html tags:
. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " 
> /DTD/xhtml1-transitional.dtd">
unrecognized command:  < invalid command name

Finally, if you click on the file in google groups and reload the redirect page (or check the browser activity window if you've got a browser with developer tools), you'll see the permanent link in the address bar which you can use with -do- or -type- , and this will work.  
You could also create a shortened URL with tinyURL, etc.  
type "";
do "";
**be sure to correct the wrapping of these commands**

~ Eric
Eric A. Booth
Public Policy Research Institute
Texas A&M University 
Office: +979.845.6754
Neal Alexander

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index