[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: ado file
tashi lama <firstname.lastname@example.org>
RE: st: ado file
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: email@example.com
> To: firstname.lastname@example.org
> 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.
> 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
> 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'
> 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: