Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, 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
daniel klein <firstname.lastname@example.org>
Re: st: ado file
Mon, 13 Aug 2012 18:11:59 +0200
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
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)")
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: