楼主: 小鳄鱼a
1304 4

补齐观测 [推广有奖]

  • 6关注
  • 10粉丝

已卖:280份资源

学科带头人

3%

还不是VIP/贵宾

-

威望
0
论坛币
125 个
通用积分
0.0040
学术水平
40 点
热心指数
45 点
信用等级
43 点
经验
32801 点
帖子
1185
精华
0
在线时间
1539 小时
注册时间
2009-7-16
最后登录
2018-10-5

楼主
小鳄鱼a 发表于 2014-12-26 12:09:37 |AI写论文
30论坛币
请看sheet2

book1.rar
下载链接: https://bbs.pinggu.org/a-1701498.html

8.27 KB

需要: 5 个论坛币  [购买]

本附件包括:

  • book1.xlsx

最佳答案

jl60156 查看完整内容

proc sql; create table test as select fcode, tcode, date1, min(date1) as mindt, max(date1) as maxdt from (select fcode, tcode, input(put(date,6.),yymmn6.) as date1 from YOURDATA) group by fcode order by fcode, tcode, date1; quit; data _null_; length fcode tcode date 8; format date yymmn6.; if _n_=1 then do; declare hash a(mu ...
关键词:sheet SHE

沙发
jl60156(未真实交易用户) 发表于 2014-12-26 12:09:38
proc sql;
     create table test as
           select  fcode, tcode, date1, min(date1) as mindt, max(date1) as maxdt
           from (select fcode, tcode, input(put(date,6.),yymmn6.) as date1 from YOURDATA)
           group by fcode
                order by fcode, tcode, date1;
quit;

data _null_;
length fcode tcode date 8;
format date yymmn6.;
if _n_=1 then do;
     declare hash a(multidata:'yes');
     a.definekey('fcode');
     a.definedata('fcode','date','tcode');
     a.definedone();
     call missing(fcode,date,tcode);
end;
     set test;
     by fcode tcode;
     retain date;
     if first.tcode then do; date=mindt; rc=a.add(); end;
     else do while(date<maxdt) ;
           date=intnx('month',date,6);
           rc=a.add();
     end;
     rc=a.output(dataset: 'want' );
run;
已有 1 人评分论坛币 收起 理由
admin_kefu + 50 根据规定进行奖励

总评分: 论坛币 + 50   查看全部评分

藤椅
Tigflanker(未真实交易用户) 发表于 2014-12-26 13:17:32
你是说这个意思吗?

1. 先按照fcode组预读每组所有的date

2. 再按照 fcode组的date池 - tcode组的date池算出一个补,接到tcode中?

前面勉强看得明白的话,这句:对于11持有的1,(前面)要补齐199912 200006 200012
就完全看不明白了。

板凳
小鳄鱼a(未真实交易用户) 发表于 2014-12-26 15:01:24
Tigflanker 发表于 2014-12-26 13:17
你是说这个意思吗?

1. 先按照fcode组预读每组所有的date
根据11,看看开始的date最早为199912,最晚为200512。


对于11持有的1,前面要补齐199912 200006 200012,因为11的跨度为199912到200512  而持有的1跨度为200106到200512

报纸
小鳄鱼a(未真实交易用户) 发表于 2015-5-29 10:46:01
jl60156 发表于 2014-12-26 12:09
proc sql;
     create table test as
           select  fcode, tcode, date1, min(date1) as mindt, m ...
你好  ,能否解释一下data  _null_以后程序的运行思路   特别是declare  hash 这段

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

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