SAS中文论坛

标题: 求助 如果转换时间 [打印本页]

作者: shiyiming    时间: 2010-1-19 02:34
标题: 求助 如果转换时间
现有一列表示时间的变量格式如下
93859
142427
141917


如何将其转换为一般的时间格式,格式如下:
09:38:59
14:24:27
14:19:17

谢谢各位大大了
作者: shiyiming    时间: 2010-1-19 10:29
标题: Re: 求助 如果转换时间
不确定原始的时间变量是字符的还是数值的,如果是数值的就不需要input()转换了
[code:2bb5gx1q]data raw;
        input time_chr $;
        time=hms(int(input(time_chr,best.)*.0001),
                        int(mod(input(time_chr,best.)*.01,100)),
                        mod(input(time_chr,best.),100));
        format time time8.;
datalines;
93859
142427
141917
;[/code:2bb5gx1q]
作者: shiyiming    时间: 2010-1-21 04:38
标题: Re: 求助 如果转换时间
Unless you alread knew on the meaning and format of the numbers.
Like date values saved as numeric value that started from a specific date as 0, time values are also saved in  numeric started from the beginning of the day.

data test;
format time1 time8.;
time=time();
time1=time;
run;




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2