B********9 发帖数: 44 | 1 Yes, that's right, it's my typing mistake, sorry~
The input function is not working. Because if we use "input" function to
reformat a char date, the result only return sas date format, which is not
what I want.
In your case: Y=input(X,datetime22.3):
X: 30SEP2011:10:12:31.705 type: Char; length: 22
Y: 1632996751.7 type: Num; Length:8
However, this is what I want:
Y: 30SEP2011:10:12:31.705 type: Num; length: 8; informat: Datetime22.3;
format: Datetime22.3.
Any suggestions? Thanks |
|
B********9 发帖数: 44 | 2 Hey, please help! Thanks in advance!
I have a character date eg: 30SEP2011:10:12:31:705. I need read this char.
date to numeric, format as datetime22.3. What function I can use it?
I know there is a function called DHMS, but only read till HH:DD:SS level,
not to HH:DD:SS:SSS.
I'm waiting on-line to see if anyone know the answer.Thanks for your kindly
helps. |
|
g*****d 发帖数: 526 | 3 看看这是你要的意思么?
data a;
x='30SEP2011:10:12:31:705';
y=input(x,date22.3);
run; |
|
B********9 发帖数: 44 | 4 Okay, let be clear on this.
I have a character date 30SEP2011:10:12:31:705 format as $30. I need to read
this date first as character. And then reformat this date to numeric and
format as datetime22.3.
What SAS function can do such converting and reformatting? Thanks |
|
g*****d 发帖数: 526 | 5 哦,我写错format了。
应该是
data a;
x='30SEP2011:10:12:31.705';
y=input(x,datetime22.);
format y datetime22.3;
run; |
|
g*****d 发帖数: 526 | 6 那就提前定义好y呗。
data a;
informat y datetime22.3;
x='30SEP2011:10:12:31.705';
y=input(x,datetime22.);
format y datetime22.3;
run;
只是个大概意思,下班了,家里没sas,不能测试了。 |
|