year | jan | feb | …… | dec |
| 1997 | 192284420 | 86376721 | …… | 136042505 |
| 1998 | 108645734 | 147656369 | …… | 24901752 |
| 1999 | 85730444 | 7416840 | …… | 181668256 |
数据集monthsum见下表
id | year | monthno |
| 1 | 1997 | 1 |
| 2 | 1998 | 4 |
| 3 | 1999 | 12 |
查询数据集ctargets来确定,一个自然的想法是将数据集ctargets的数据存储在一个多维数组里,代码如下:
- data lookup;
- array targets{1997:1999,12} _temporary_;
- if _n_=1 then do i=1 to 3;
- set ctargets;
- array mnth{*} jan--dec;
- do j=1 to dim(mnth);
- targets{year,j}=mnth{j};
- end;
- end;
- set monthsum(keep=id year monthno);
- ctarget=targets{year,monthno};
- run;
《SAS编程与数据挖掘商业案例》将_n_解释为“指向对应的某条观测”,那么然后将set ctargets运行三次,连续读取了数据集ctargets的三条观测,这样一来感觉有矛盾。
还请高手交代一下_n_真正的含义,不胜感激。



雷达卡



京公网安备 11010802022788号







