全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1440 0
2012-03-30
Several call routine in SAS/IML are now can be defined in FCMP and used in data step and other proccedures. Here is an example for inverse a matrix(array) in data step.

proc fcmp outlib=sasuser.funcs.temp;;
     subroutine invert (mat[*,*],invmat[*,*] );
      outargs invmat;
      call inv(mat, invmat);
      endsub;
run;
quit;

options cmplib=sasuser.funcs;

data _null_;
  array a(3,3) _temporary_   ( 1 2 3,
                               2 2 4,
                               3 4 5
                             );
  array b(3,3) _temporary_ ;
  call invert (a, b);

  do i=1 to dim1(b);
    do j=1 to dim2(b);
      put b[i,j] @;
    end;
    put;
  end;
run;

***check with iml;
proc iml;
a={ 1 2 3,
     2 2 4,
     3 4 5
    };
b=inv(a);
print b;
quit;



二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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