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: ado file


From   tashi lama <ltashi32@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: ado file
Date   Mon, 13 Aug 2012 16:59:05 +0000

Makes sense.. Thanx.
----------------------------------------
> Date: Mon, 13 Aug 2012 18:11:59 +0200
> Subject: Re: st: ado file
> From: klein.daniel.81@googlemail.com
> To: statalist@hsphsun2.harvard.edu
>
> Tashi,
>
> your -clear- command is not part of the program you define. Running
> the (ado-)file once, clears the memory, defines -dd- and executes it.
> This happens, when you first call -dd- (given you saved the ado-file
> as dd.ado, where Stata can find it - this is the answer to your second
> question). Your second call to -dd- does not run the entire ado-file
> again, as this would be rather slow. Instead Stata executes the
> already defined program -dd-, which is now in memory, and has no
> -clear- statement in it.
>
> As Nick Cox guessed in previous posts, it seems you are writing these
> kind of programs merely to learn programming, so I will not comment on
> anything beyond your question here.
>
> Best
> Daniel
>
> --
> I am writing a simple ado-file where I am generating a dataset using
> sql query and listing the variable using syntax command. Here is my
> code
> clear
> program dd
> qui odbc query indigo_dev71
> odbc load, exec("select date(read_date) as date, count(*) as hits from
> readership where source_id=6429 and date(read_date) between
> '2011-01-01' and '2011-01-20' group by date(read_date)")
> syntax [varlist]
> list `varlist'
> end
> exit
>
> [...]
>
> Great. But when I run second time .dd date
> Stata returns you must start with an empty dataset. I have a "clear"
> command at the top of my adofile to start with a fresh memory. Could
> someone please explain? Also, does adofile name have to be identical
> to the program name? Meaning, my program name here is dd. Do I have to
> have a adofile dd.ado? If they could be different, how do I execute?
> *
> * 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