楼主: rockfido
2026 4

[原创博文] Question about MONYY5. format [推广有奖]

  • 0关注
  • 0粉丝

已卖:1754份资源

博士生

32%

还不是VIP/贵宾

-

威望
0
论坛币
2715 个
通用积分
0.0341
学术水平
1 点
热心指数
1 点
信用等级
0 点
经验
4441 点
帖子
201
精华
0
在线时间
202 小时
注册时间
2008-8-29
最后登录
2024-11-1

楼主
rockfido 在职认证  发表于 2010-12-23 11:05:32 |AI写论文
30论坛币
I have the following data set A with variable Mon (format: MONYY5.)

Mon
JAN10
FEB10
MAR10
APR10
MAY10

I want to get only records that after MAR10, but how can i use the GT in the code?

Data B;
Set A;
Where Mon GT 'MAR10'D.;------i KNOW its wrong, but I dont know how to do it right....
RUN;

最佳答案

elek.me 查看完整内容

Hello. rockfido. MONYY5. is an useful INFORMAT. You can use this INFORMAT and INPUT function to convert a character into a date value. The following is one of the solutions to your question. Hope it helps.
关键词:question format Quest FORMA About following records about wrong

沙发
elek.me 发表于 2010-12-23 11:05:33

Hello.  rockfido.
MONYY5. is an useful INFORMAT.  You can use this INFORMAT and INPUT function to convert a character into a date value.  The following is one of the solutions to your question.
Hope it helps.

  1. data a;
  2.         input Mon monyy5.;
  3. cards;
  4. JAN10
  5. FEB10
  6. MAR10
  7. APR10
  8. MAY10
  9. ;

  10. data b;
  11.         set a;
  12.         if mon gt input("MAR10",monyy5.);
  13. run;
复制代码

我的博客: http://elek.me/sas
联系我: http://about.me/elek

藤椅
horace_chen 发表于 2010-12-23 13:09:02
Data B;
Set A;
Where mon GT '31MAR10'D;
RUN;

板凳
elek.me 发表于 2010-12-23 14:01:56
不知道怎么删自己的贴。 囧。
我的博客: http://elek.me/sas
联系我: http://about.me/elek

报纸
6203479170 发表于 2010-12-24 10:17:38
HI,try this code .
it works if the day  i added into doesn't make any difference
data test;
input mon monyy5.;
cards;
JAN10
FEB10
MAR10
APR10
MAY10
;
data b;
set test;
if mon >'01MAR10'd;
run;

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 02:25