Statalist


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

Re: st: AW: Data transfer woes


From   "Clemens P. Masesa" <[email protected]>
To   [email protected]
Subject   Re: st: AW: Data transfer woes
Date   Wed, 24 Jun 2009 11:03:04 +0300

No, not really.  The data that I have is of the type double and not string.

Building on what you sent me, the data is like:

********
clear*
inp double date
1453593600000
1454803200000
1458432000000
1461456000000
1463875200000
end
********

While waiting for feedback I experimented and found that "dofc" will do the conversion I need as in this case:

********
clear*
inp double date
1453593600000
1454803200000
1458432000000
1461456000000
1463875200000
end
replace date = dofc(date)
format date %td
l, noobs
**************

Thank for helping

Kind regards,

Clemens


Martin Weiss wrote:
<>
Does this example address your problem?

*************
clear*
inp str20 date
"19mar2009 23:59:43"
end
gen date2=date(date, "DMYhms")
format date2 %td
l, noobs
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Clemens P.
Masesa
Gesendet: Mittwoch, 24. Juni 2009 09:12
An: [email protected]
Betreff: st: Data transfer woes

Hello,

I am new to STATA and I am having a problem with date fields when transferring data from SQL Server to STATA 10 format using StatTransfer 9.

In the database the date fields are specified as Date, not DateTime. When I do the transfer the fields come out as long with format %tc. When I browse the data I see "19mar2009 23:59:43".

My programs depend on the field to be of the form %td, as in "19mar2009" and thus my programs break! I try changing the format to %td and when I brows the data as see 1.454e+12.

I notice that usually date fields are of the type float and changing /setting the format to %td gives me what i need

Could someone please help me by telling me what I am doing wrong.

Kind regards,

Clemens
*
*   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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index