SAS无法识别日期格式 [英] SAS not recognizing date format

查看:330
本文介绍了SAS无法识别日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有以下字符日期格式:

I have the following character date format:

"3/1990"
"4/1990"
"5/1990"
...

我尝试了以下代码:

data work.temps;
  set indata;
  newdate = input(strip(Date), MMYYSw.);
  rename newdate = date;
run;

我不断收到以下错误消息:未找到信息MMYYSW或无法加载。

I keep on getting the following error meassage: Informat MMYYSW was not found or could not be loaded.

推荐答案

您可能必须使用其他信息读取字符日期,以便SAS可以将它们解释为数字(因为SAS中的日期实际上是数字值),然后将其格式设置为 MMYYS。

You may have to use a different informat to read in the character dates so that SAS can interpret them as numeric (since dates in SAS are actually numeric values), and then format them as MMYYS..

这已经过测试并且对我有用:

This was tested and works for me:

DATA temps;
FORMAT newdate MMYYS.;
SET indata;
newdate = INPUT(COMPRESS('01/'||date),DDMMYY10.);
RUN;

这篇关于SAS无法识别日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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