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, is already up and running.

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

st: Re: st is it stata or something else acting off

From   daniel klein <>
Subject   st: Re: st is it stata or something else acting off
Date   Fri, 14 Sep 2012 17:34:09 +0200


it seems you are not reading the help files very carefully. Typing

[...] STARTdate(str)

indeed allows you to abbreviate option startdate() to start(). However
this does not mean, that the specified string is stored in local
<start>. It is still stored in local <startdate> (the option's name).
Therefore your code

odbc load, [...] between '`start'' and '`end''")

evaluates to

odbc load, [...] between and )

and causes an error.

Just a word on programming style/readability: I would prefer

syntax, STARTdate(str) ENDdate(str) [ DOC_type(str) analyst(str)
ticker(str) sector(str) firm(int -1) stat(str) ]
if "`doc_type'"!=""{


syntax, [DOC_type(str)] [ANALYST(str)]  [TICKER(str)] [SECTOR(str)]
STARTdate(str) ENDdate(str) [FIRM(int -1)] [STAT(str)]
if "`doc_type'"!=""{


Hello all,
    I have my syntax options capitalised to allow abbreviation. It
works with all other options listed below except startdate and
enddate. Here is the detail.

program foo
syntax, [DOC_type(str)] [ANALYST(str)]  [TICKER(str)] [SECTOR(str)]
STARTdate(str) ENDdate(str) [FIRM(int -1)] [STAT(str)]
if "`doc_type'"!=""{
  odbc load, exec("select count(*) from reader where read_date between
'`start'' and '`end''")

foo, doc(company) start(2011-01-01) end(2011-04-01) firm(567)

  The ODBC driver reported the following diagnostics
[MonetDB][ODBC Driver 11.9.5]timestamp () has incorrect format
22007!timestamp () has incorrect format


Any idea??
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index