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: run STATA DO files on web?


From   <[email protected]>
To   "STATA list post" <[email protected]>
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.
 
Neal
 
Date: Wed, 3 Mar 2010 22:13:32 -0600
From: Eric Booth <[email protected]>
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:  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
[email protected] 
Office: +979.845.6754
 
 
Neal Alexander        http://www.lshtm.ac.uk/people/alexander.neal

*
*   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