所有的命令我都在sas9.1运行过,可以放心使用哦
data aa bb;/*拆分数据(过滤抽取) */
set sasuser.wage;
select (race);
when('1')output aa;
when('2')output bb;
otherwise put race='wrong';/*put语句输出到日志窗口 */
end;
run;
data cc;/*纵向合并 */
set aa(in=y) bb(in=b) ;
if y=1 then race1='1';
if b=1 then race1='2';
run;
data dd ;/*建立一个临时数据集待会儿横向合并用的 */
input obs@@;
cards;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
;
run;
data ee;/*横向合并 */
merge dd cc ;
run;
proc sort data=sasuser.wage out=ff;/*排序out 输出数据集*/
by descending wage;/*降序*/
run;
proc iml;/*交互式矩阵语言 */
reset print;
a={1 2,3 4};/*生成矩阵a*/
b={1 2,2 1};/*生成矩阵b*/
c=a+b;
d=a*b;
f=2#a; /*矩阵a与2想乘*/
g=a**2; /*矩阵a的2次方*/
h=a**-1; /*矩阵a的逆*/
i=a` ; /*矩阵a的转置矩阵*/
quit;



雷达卡




京公网安备 11010802022788号







