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]
RE: st: RE: converting SAS file to stata using stat transfer-date and time variables
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
RE: st: RE: converting SAS file to stata using stat transfer-date and time variables
Date
Tue, 21 Dec 2010 16:42:04 +0000
Approaching this from a different angle:
Advising on exactly what happens when you want to transfer from A to D using B and/or C (here SAS, Stata, Stat/Transfer and MS Excel) would seem to require
1. expertise on A, B, C and D (not many of us qualify)
2. exact details of precisely what was done (for example, I don't know what precisely "conversion to excel" means).
The conversion to Stata dates is often made even difficult to understand because, even though the facts are explained in the documentation,
(a) dates are not a distinct type (meaning storage type) in Stata; they are just held as some kind of integer type, but that doesn't define them as dates
(b) dates are intelligible as such within Stata given appropriate formats and manipulation using appropriate functions, but neither has anything much to do with the way that other software sees the same data
(c) there's a prevailing misimpression that formats define storage or how data are held, but they define only how data are displayed.
To be fair, the meaning of "type", "format", etc. varies between software, and the subtle differences can be just as puzzling as the stark differences.
Just to cheer people up at what is for many a holiday time,
Nick
[email protected]
Anders Alexandersson
Leny, what is weird? Nick (and others, including Bill Gould) gave you
a reasonable explanation to the problem and useful advice.
Stat/Transfer does not support conversions between any of the numeric
types, dates, or strings.
I guess this is why the conversion results surprised you.
You are using an old version of Stat/Transfer. Some people might think
that is weird.
If you need more help, please provide log files.
Leny Mathew
> Thanks Nick. It's weird considering that the conversion to excel works
> fine. I can convert it as a csv file and then get it into stata
> without any issue.
Nick Cox
>> I wouldn't assume much in this territory. Dates and times seem simple in principle but can be very awkward in practice.
>>
>> On this information, my only guess is that time (presumably time of day, up to 24hr) is being converted to fraction of a day. You need to look really closely at the data in SAS and in Stata.
Leny Mathew
>> I'm trying to convert a SAS file (V 9.1) with date and time variables
>> (separate) into stata and I'm using stat transfer (version 8) for
>> this. During the conversion, the date variable comes across fine, but
>> all the time variable values are between 0 and 1. stat transfer reads
>> the SAS file without any problem, it looks fine in the viewer and it
>> converts into excel without any problem. I didn't have to format the
>> date variable within stata, so I'm assuming that I don't have to do
>> any formatting for the time variable either. Has anyone had this issue
>> before?
>> Any comments are much appreciated. I'm using stata 10.1
*
* 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/