为什么信息在 SAS 中不起作用 [英] Why informat is not working in SAS

查看:52
本文介绍了为什么信息在 SAS 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试了各种格式的日期,但输出不反映任何日期.可能是什么问题?

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;

推荐答案

你有点搞混了.日期格式将应用于数字数据,而不是文本数据.所以你不应该把 doj 读作 $(文本),而应该读作日期(所以是日期信息).

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).

试试 DDMMYY10.输入语句中的 doj :

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;

这篇关于为什么信息在 SAS 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆