Skip to content

Instantly share code, notes, and snippets.

View ymattu's full-sized avatar

Yuya MATSUMURA ymattu

View GitHub Profile
@ymattu
ymattu / group_concat.sas
Created October 19, 2016 16:11
SASでSQLのgroup_concat的なことをやる
/*https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-GROUP-BY-to-concatenate-strings-in-SAS-proc-SQL/td-p/208967*/
data want (drop=string_old);
set tmp (rename=(string=string_old));
by id;
retain string;
length string $ 20; * set large enough to accommodate the maximum number of records per ID;
if first.id then string = '';
string = catx(',',trim(string),string_old);
if last.id then output;
run;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
%macro aloop;
%do i = 65 %to 90;
data mydata%sysfunc( byte(&i) ) ;
A=1;
run;
%end;
%mend;
%aloop;
%macro chloop;
%let loopval= A B C D E;
%do i=1 %to %sysfunc(countw(&loopval));
%let j=%scan(&loopval,&i);
data mydata&j;
A=1;
run;
%end;
%mend;
%macro dloop;
%let loopval=1 2 3 5;
%do i=1 %to %sysfunc(countw(&loopval));
%let j=%scan(&loopval,&i);
data mydata&j;
A=1;
run;
%end;
%mend;
proc sql outobs=1000;
select A
from work.hoge
where A > 30
;
quit;
@ymattu
ymattu / Preferences.sublime-settings
Created April 10, 2016 08:40
Sublime Text 3 のセッティング
{
"color_scheme": "Packages/One Dark Material - Theme/schemes/OneDark.tmTheme", // カラースキーム
"theme": "Material-Theme-Darker.sublime-theme", // テーマ
"material_theme_small_tab" : true, // タブを小さく
"material_theme_small_statusbar" : true, // ステータスバーを小さく
"material_theme_compact_sidebar" : true, // サイドバーを小さく
"material_theme_compact_panel" : true, // 検索窓を小さく
"font_face": "Ricty Diminished", // フォント
"font_size": 16, // フォントサイズ
"font_options": [ "gray_antialias", "subpixel_antialias" ], // RetinaのMacとWindows場合
data
{
int<lower=0> N; //サンプルサイズ(ユニークな個人)
int<lower=0> NT; //サンプルサイズ(全体)
int<lower=0, upper=1> y[NT]; //目的変数(離反)
int id[NT]; //ユニークな個人の数
vector[2] x[NT]; //切片と価格
vector[10] w[NT]; //環境変数
matrix[N,4] z; //属性
}
options ls=78;
title "Bivariate Normal Density";
%let r=0.7;
data a;
pi=3.1416;
do x1=-4 to 4 by 0.1;
do x2=-4 to 4 by 0.1;
phi=exp(-(x1*x1-2*&r*x1*x2+x2*x2)/2/(1-&r*&r))/2/pi/sqrt(1-&r*&r);
output;
end;
data cdf;
do x = -3 to 3 by 0.1;
y = cdf("Normal", x);
output;
end;
run;
ods graphics / height=500;
proc sgplot data=cdf noautolegend;
title "Normal Cumulative Probability";