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


From   daniel klein <klein.daniel.81@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: ado file help
Date   Mon, 13 Aug 2012 23:52:21 +0200

Tashi,

first of all, stop using -clear- before defining the program. Having a
-clear- command in an ado-file is dangerous, as you will lose your
data typing -dd- for the first time. This is likely to bite. The way
to do this, is to have a -clear- option in the program.

Second, you are of course free to chose any syntax you like, but

dd end_date="2011-01-20" graph_type="line" start_date="2011-01-01"
broker_id=6429

is not very "stataish" (looks more like R to me).

I would probably code this as

pr dd
    vers 12.1
    syntax , end_date(str) graph_type(str) start_date(str)
broker_id(str) [clear]
    `clear'
    [...]
end

If you really want to (re)invent your own wheel, have a look at
-tokens- and -gettoken-.

Best
Daniel

-- 
Hello all,
    I wrote a do-file a while ago with 4 arguments as follows:

[...]

This makes this code not so convenient and I would like to attempt to
write a code (possible ado file with synatx) so that the code would
run when

dd graph_type="pie" start_date="2011-01-01" broker_id=6429 end_date="2011-01-20"
or
dd end_date="2011-01-20" graph_type="line" start_date="2011-01-01"
broker_id=6429

I tried but got stuck

begin adofile dd
clear
program dd
syntax anything
qui odbc ...
odbc load, exec(".....

Could someone provide me an idea to accomplish this?
*
*   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