Good catch, I guess.
Nick
[email protected]
Austin Nichols
Jacob Smith <[email protected]>:
Try:
local lda: di %td da
local lfd: di %td fd
instead of
local lda %td da
local lfd %td fd
since the latter will only work the way you want after -display-.
On Tue, Oct 14, 2008 at 11:14 AM, Jacob Smith <[email protected]>
wrote:
> Hi,
>
> I have tried to find a solution to how to use a local variable to pass
> two dates to a twithin() statement.
>
> I currently have to pull a date range from a ODBC connection and I am
> trying to use the dates I retrieve to some information from another
> information source. If I manually put in twithin(07oct2008, 17oct2008)
I
> have no problems, but I cannot seem to get the contents of a local
> variable to work within the twithin() option. I have tried with both
the
> double representation of a date as well as a string, and it seems
almost
> any other possible combination with no luck.
>
> Currently this is what I am trying to run:
>
>
> clear
> odbc load, exec("SELECT day, futuredate FROM Table ORDER BY day DESC
> LIMIT 1") dsn("DSN")
> scalar da=day
> local lda %td da
> scalar fd=futuredate
> local lfd %td fd
>
> clear
> haver use FLODON FLOD1 FLOD3 FLOD6 FLOD1Y using
c:\location\of\file.dat,
> twithin(`lda' ,`lfd')
>
> Here is what my local variables look like:
>
> . di `lda'
> 07oct2008
> . di `lfd'
> 17oct2008
>
> and when I use the following I have no problem:
>
> . haver use FLODON FLOD1 FLOD3 FLOD6 FLOD1Y using
> c:\location\of\file.dat, twithin(07oct2008,17oct2008)
>
*
* 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/