Skip to content

Instantly share code, notes, and snippets.

View ymattu's full-sized avatar

Yuya MATSUMURA ymattu

View GitHub Profile
proc iml;
submit/R;
airquality;
endsubmit;
run ImportDataSetFromR("work.air","airquality");
quit;
proc print data=air(obs=30); /*データの確認(変数名など)*/
run;
@ymattu
ymattu / wordcloud35_mac.py
Created January 17, 2016 06:18
ワードクラウド(Python3.5, Mac)
# coding:utf-8
import matplotlib.pyplot as plt
from wordcloud import WordCloud
from bs4 import BeautifulSoup
import requests
import MeCab as mc
def mecab_analysis(text):
t = mc.Tagger("-Ochasen")
@ymattu
ymattu / iml_linear_regression.sas
Last active January 28, 2016 04:49
iml_linear_regression
proc iml;
submit/R;
attitude;
endsubmit;
run ImportDataSetFromR("work.attitude","attitude");
use attitude;
read all into M; /*attitudeを行列化*/
L = nrow(M); /*Mの行数*/
@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;
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; /* データセットを閉じる */
proc datasets lib=work kill memtype=data;
run;
proc datasets lib=work memtype=data;
delete Ds1;
run;
proc datasets lib=work memtype=data;
save Ds1;
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:;