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 in a batch mode using do file


From   tashi lama <ltashi32@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: run stata in a batch mode using do file
Date   Wed, 19 Sep 2012 21:09:37 +0000

Ouch.. I actually got this. Is it a good thing?? Stata does run adofile in a batch mode. 

/* begin adofile try.ado */
program try
   syntax, firm(int)
   qui odbc query indigo
   odbc load, exec("select date(read_date) as date, count(*) as hits from readership where source_id=`firm' and date(read_date) between '2011-01-01' and '2011-05-01' group by date")
   list
   destring hits, replace
   tsset date
   tsline hits
end 

In Shell
$ stata -b try ", firm(93619)"    //yields try.log 

Stata and Shell both are happy. I hope there aren't any catches. 

Thanks, 
Tashi 



----------------------------------------
> From: brendan.halpin@ul.ie
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: run stata in a batch mode using do file
> Date: Wed, 19 Sep 2012 18:16:13 +0100
>
> On Wed, Sep 19 2012, tashi lama wrote:
>
>> Out of curiosity, why is it that stata can't run ado file directly in a
>> batch mode? It is very inconvenient for someone like me who prefer to
>> write adofile than a do file because it is faster and better in
>> design(arguments arent positional).
>
> An ado-file simply defines and makes available a command. It doesn't
> "do" anything, in the sense of carrying out actions on data or creating
> output.
>
> Brendan
> --
> Brendan Halpin, Department of Sociology, University of Limerick, Ireland
> Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F1-009 x 3147
> mailto:brendan.halpin@ul.ie ULSociology on Facebook: http://on.fb.me/fjIK9t
> http://teaching.sociology.ul.ie/bhalpin/wordpress twitter:@ULSociology
> *
> * 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