Why informat is not working in SAS

ぃ、小莉子 提交于 2019-12-12 01:41:11

问题


Tried various formats of date, but output do not reflects any date. What could be the issue?

data c;
input age gender income color$ doj$;
format doj date9.;
datalines;
19 1 14000 W 14/07/1988
45 2 45000 b 15/09/1956
34 2 56000 y 14/09/1967
33 1 45000 b 14/02/1956
;
run;

回答1:


You are mixing things up a bit. The date formats are to be applied on numeric data, not on text data. So you should not read in doj as $ (text), but as a date (so a date informat).

Try DDMMYY10. for doj on your input statement:

data c;
    input age gender income color$ doj ddmmyy10.;
    format doj date9.;
    datalines;
    19 1 14000 W 14/07/1988
    45 2 45000 b 15/09/1956
    34 2 56000 y 14/09/1967
    33 1 45000 b 14/02/1956
    ;
run;


来源:https://stackoverflow.com/questions/17515429/why-informat-is-not-working-in-sas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!