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: converting SAS file to stata using stat transfer-date and time variables
From
Sergiy Radyakin <[email protected]>
To
[email protected]
Subject
Re: st: converting SAS file to stata using stat transfer-date and time variables
Date
Mon, 20 Dec 2010 15:52:20 -0500
On Mon, Dec 20, 2010 at 12:09 PM, William Gould, StataCorp LP
<[email protected]> wrote:
>> 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?
>
> This should be easy because SAS and Stata save times in similar ways.
> Stata stores times as microseconds since 01jan1960; SAS as seconds. Thus,
^^^^^ IMHO instead of "microseconds" should probably be "milliseconds"
Best, S.R.
> the transormation is
>
> . gen double stata_time = sas_time*1000
> . format stata_time %tc
>
> Be sure that the original SAS time is recorded as a double.
>
> Leny wrote "all the time variable values are between 0 and 1". I'm assuming
> they are actually very large numbers and Leny didn't notice the e+## on
> the end. If the numbers really are between 0 and 1, I don't think they
> are SAS time values.
>
> -- Bill
> [email protected]
> *
> * 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/