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 help
Nick Cox <firstname.lastname@example.org>
Re: st: ado file help
Tue, 14 Aug 2012 16:48:31 +0100
I don't understand your first sentence: I can't see your code and thus
don't see references to -var1- and -var2-.
But your criticism of -syntax- is incorrect, not to say absurd. The
purpose of -syntax- is to signal to Stata what is valid syntax in a
program, no more, no less. Much of what a syntax statement does in
practice is to look forward to what the program will do, including
generate new variables. As I have already said, you can signal
variable names that you want to use, just not as if they were existing
On Tue, Aug 14, 2012 at 4:40 PM, tashi lama <email@example.com> 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
>> From: firstname.lastname@example.org
>> To: email@example.com
>> 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 <firstname.lastname@example.org> 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)")
>> > .......
>> > end
>> > 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:
>> * 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/
* For searches and help try: