Bookmark and Share

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


[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 <[email protected]>
To   [email protected]
Subject   st: Re: st is it stata or something else acting off
Date   Fri, 14 Sep 2012 17:34:09 +0200

Tashi,

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'"!=""{

to

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

Best
Daniel

-- 
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''")
  ............
  ............
}
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
SQLSTATE=22007
r(682);

[...]

Any idea??
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index