Skip to content

Instantly share code, notes, and snippets.

View ymattu's full-sized avatar

Yuya MATSUMURA ymattu

View GitHub Profile
data pdf;
do x = -3 to 3 by 0.1;
y = pdf("Normal", x);
output;
end;
run;
proc sgplot data=pdf noautolegend;
title "Normal Probability Density";
series x=x y=y;
data income2;
set 'C:/Users/ユーザー名/Desktop/income_analysis/income.sas7bdat' ;
run;
libname income 'C:/Users/ユーザー名/Desktop/income_analysis' ;
data "income.sas7bdat";
infile 'income.data';
input gender race persinc;
if persinc = 99 then persinc=.;
run;
****(1). Data exploration of iris flower data set****;
data iris;
set sashelp.iris;
run;
proc contents data=iris position;
run;
proc princomp data=iris out=iris_pca;
var Sepal: Petal:;
proc datasets lib=work memtype=data;
save Ds1;
run;
proc datasets lib=work memtype=data;
delete Ds1;
run;
proc datasets lib=work kill memtype=data;
run;
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; /* データセットを閉じる */
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; /* データセットを閉じる */
@ymattu
ymattu / dataset_iml_to_sas.sas
Last active February 6, 2016 10:56
IMLで作った行列をSASデータセットにする
proc iml;
x = {1,0,3,2,0,3}; /* 6 × 1 ベクトル */
y = {8,7,6,5,6}; /* 5 × 1 ベクトル */
z = {A A A B B B}; /* 1 × 6 ベクトル */
create DATA1 var {x y z}; /* データセットを作る */
append; /* データをベクトルの中に入れる */
close DATA1; /* データセットを閉じる */
quit;