2018年2月28日星期三

A SAS macro to rename all variable names in a data set

Data one;
 U_2=1;
 V_3=2;
 X_2=3;
 Y_2=4;
 Z_3=5;
Run;

options macrogen mprint mlogic;
%macro rename(lib,dsn);
options pageno=1 nodate;
proc contents data=&lib..&dsn;
title "Before Renaming All Variables";
run;
proc sql noprint;
 select nvar into :num_vars
 from dictionary.tables
 where libname="&LIB" and
 memname="&DSN";
 select distinct(name) into :var1-
:var%TRIM(%LEFT(&num_vars))
 from dictionary.columns
 where libname="&LIB" and
 memname="&DSN";
quit;
run;
proc datasets library=&LIB;
 modify &DSN;
 rename
 %do i=1 %to &num_vars;
 &&var&i=%substr(&&var&i., 1, %length(&&var&i.)-2)
%end;
;
quit;
run;
options pageno=1 nodate;
proc contents data=&lib..&dsn;
title "After Renaming All Variables";
run;
%mend rename;
%rename(WORK,ONE);/***Note the library and database name should be all in CAPITAL LETTERS)****/

2018年1月9日星期二

Some reviews for Martingales

1. Simple Random Walk
2. Sample path
https://math.stackexchange.com/questions/1472068/what-is-a-sample-path-of-a-stochastic-process

2017年9月30日星期六

Statistical Errors in the Medical Literature

http://www.fharrell.com/2017/04/statistical-errors-in-medical-literature.html