全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2663 4
2013-04-04
如果我的date变量中日期格式是mmddyyyy9.,如何将同一年的数据选出来?下面year用什么函数呢?thanks

proc sql;
create table dateset1 as


select distinct year ,count(year) as Tm90



from dateset



where TmaxF>=90



group by year;



quit;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-4-4 23:57:06
就是Year, 比如 YEAR(Date) 返回相应年份
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-5 00:31:23
tyweng0721 发表于 2013-4-4 23:57
就是Year, 比如 YEAR(Date) 返回相应年份
thanks,but still not working

data dateset;
        set dateset;
        format Date mmddyy10.;
        proc print data=dateset;
        run;

proc sql;
    create table table1 as
      select distinct year(Date) as year,count(year) as daysofTm90
        from dateset
                where TmaxF>=90
                group by year;
                quit;

Log  proc sql;
79       create table table1 as
80         select distinct year(Date) as year,count(year) as daysofTm90
81           from dateset
82           where TmaxF>=90
83           group by year;
ERROR: The following columns were not found in the contributing tables: year.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-5 00:36:41
try this

proc sql;
     create table dateset1 as
     select distinct year(date) as year ,count(year(date)) as Tm90
from dateset
where TmaxF>=90
group by calculated year;
quit;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-4-5 00:44:19
yongyitian 发表于 2013-4-5 00:36
try this

proc sql;
it works, thanks very much!!!!!!!!!!!!!!!!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群