Skip to content

Instantly share code, notes, and snippets.

@ymattu
Created February 6, 2016 11:42
Show Gist options
  • Save ymattu/92bcaa12826fd54ceec7 to your computer and use it in GitHub Desktop.
Save ymattu/92bcaa12826fd54ceec7 to your computer and use it in GitHub Desktop.
proc iml;
x = {1,0,3,2,0,3}; /* 6 × 1 ベクトル */
A = J(6,1,1); /* 6 × 1ですべての要素が1の行列 */
reg_data = A || x; /* Aとxを横に連結 */
create DATA2 var {A x}; /* データセットを作る */
append from reg_data; /* どの行列からデータを作るか */
close DATA2; /* データセットを閉じる */
quit;
proc print data=DATA2;
run;
/**ここまではさっきと同じ**/
proc iml;
use DATA2;
read all;
B = A + x;
print B;
quit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment