Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: ado file help

From   Nick Winter <>
Subject   Re: st: ado file help
Date   Tue, 14 Aug 2012 11:44:01 -0400

As (the other) Nick has suggested, you would probably be well-served to read the help and/or manual entries on -syntax-, and on programming more generally.

In this case you could use an additional option to specify (new) variables to create or graph or whatever, or you could use anything rather than varlist.

But really you probably should work your way through a series of practice programs, manual in hand, to get a feel for how this stuff works.

Nick Winter

On 8/14/2012 11:40 AM, tashi lama wrote:
in this code, 2 variables are created namely var1 and var2. So, I want to create a dataset using syntax options, which I did.  I would also like to have the flexibility of drawing graphs of the variables I want ( say for example tsline var1 or var2 or both)  or list the variables(say for example list var2 or var2 or both )  for that matter. What really sucks is syntax's limitation to only look backward. As I said, I could have syntax statement after creating dataset( and I am sure that wouldn't be that hard) but for this particular example, I need to define it before to create datasets on first place.

Note: I am very careful to not use any abbreviation while posting ):  example for eg.

Date: Tue, 14 Aug 2012 16:23:00 +0100
Subject: Re: st: ado file help

Quite. -varname- or -varlist- in a -syntax- statement refers to an
existing variable; if what you supply is not the name of an existing
variable, that is an error. That will be inevitable if there are no
data in memory.

If you need to supply such a name, you must supply it in some other
way. I thought that the main purpose of this program was to read in
data and that -odbc- takes care of that for you.


On Tue, Aug 14, 2012 at 4:15 PM, tashi lama <> wrote:
Works like a magic. Thanx guys. There is a slight problem however. If I were to extend this and include varlist in the syntax,

syntax [varlist], STARTdate(str) ENDdate(str) BROKERid(numeric) GRAPHtype(str)
obdc load, exec("select date(read_date), count(*) from readership where source_id==`brokerid' and date(read_date) between '`startdate'' and '`enddate'' group by date(read_date)")

and when I call
dd var1, startdate("2011-01-01") enddate("2011-01-20") broker(6429)
stata isn't happy and returns "no variables defined". It makes kind of sense syntax command doesn't see any data since it is defined before generating dataset. However, I need to define syntax, options to generate dataset in first place. Any idea how to solve this?

* For searches and help try:
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index