SAS 无法识别日期格式 [英] SAS not recognizing date format
本文介绍了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;
我不断收到以下错误消息:Informat 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屋!
查看全文