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 at the end of May, and its replacement, statalist.org 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   Eric Booth <ebooth@ppri.tamu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: run STATA DO files on web?
Date   Wed, 3 Mar 2010 22:13:32 -0600

>

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:  http://groups.google.com/group/mygroup/web/myfile.do   it redirects to   http://mygroup.google.groups.com/web/myfile.do 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 "test.do" to the google group for Stata users at http://groups.google.com/group/stata-users-forum/web/test.do

If I simply use the link for "test.do", here's the error I get:
***************
do http://groups.google.com/group/stata-users-forum/web/test.do

/*
file http://groups.google.com/group/stata-users-forum/web/test.do not found
server says file permanently redirected to http://stata-users-forum.googlegroups.com/web/test
> .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 "http://stata-users-forum.googlegroups.com/web/test.do";
*this gives me all the html code*

do "http://stata-users-forum.googlegroups.com/web/test.do";
**this gives the error below because stata doesnt understand the html tags:
/*
. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1
> /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.  

e.g., 

********
type "http://stata-users-forum.googlegroups.com/web/test.do?gda=SSPw7TkAAAAPhBKiy-Lip7KBXQRJm6l7AkTaK8g6FtbEzVxEVHzAqNf1Dl8eJvI6PhNUW9PsXbqECKgQbmraGdxlZulaYnsh";

do "http://stata-users-forum.googlegroups.com/web/test.do?gda=SSPw7TkAAAAPhBKiy-Lip7KBXQRJm6l7AkTaK8g6FtbEzVxEVHzAqNf1Dl8eJvI6PhNUW9PsXbqECKgQbmraGdxlZulaYnsh";

**be sure to correct the wrapping of these commands**

*******


~ Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754

On Mar 3, 2010, at 9:00 PM, Kit Baum wrote:

> <>
> I don't have any problem with Stata commands like
> 
> type http://fmwww.bc.edu/cfb/stata/testweb.do
> do http://fmwww.bc.edu/cfb/stata/testweb
> 
> The do-file runs just fine. My web server (Apache) is configured to serve .do, .ado etc. as MIME text/plain. Perhaps on some servers (particularly Microsoft IIS) a ".do" file is served as some other MIME type which Stata does not like.
> 
> Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
>                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
>   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html
> 
> 
> *
> *   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/





*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index