Today, I would introduce the simple code to generate the quantile of variables with SAS macro code.


%macro decile(tbl, var);

 /* noprint option means this procedure doesn't print the basic univariate statistics */

 proc univariate data = &tbl. noprint;

 /* Input variable you want to review */

   var &var.;

/* output dataset name

     pctlpre : percentile pre-naming, This is output variable name

     prctlpts : percentile plots, you can specify the interval of percentile

*/

   output out = &var. pctlpre = &var. pctlpts = 10 to 100 by 10;

 run;

%mend;



%decile(base.table, usage);

%decile(base.table, energy_util);


반응형

'SAS, R, 통계' 카테고리의 다른 글

딥러닝 읽어볼 글  (0) 2017.02.23
R *.gz file에서 컴파일 하는 방법  (0) 2017.01.23
악어 자료에 대한 기준범주 로짓 모형의 적합 분석  (0) 2016.10.24
proc genmod moel y/n = x  (0) 2016.10.22
R Transform  (0) 2016.10.21

+ Recent posts