For “ERROR: Some character data was lost during transcoding in the dataset DB.XXXDAT. Either the data contains characters that are not representable in the new encoding or truncation occurred during transcoding.” use the following code in program: proc…
Tag: Data Manipulation
Convert CHAR to NUM in PROC SQL
Use TO_NUMBER function in PROC SQL. proc sql; connect to oracle (user=xxx orapw=yyy path=”@zzz”); create table temp as select * from connection to oracle &nb…
Rolling Window Regression of Time Series
More often than not, we encounter a problem where an OLS over a rolling time window is required, see [1], [2], [3], [4], [5], [6], [7], for a few examples.
One solution is to resort to SAS MACRO, but it is extremely inefficient and can’t handle lar…
Regularized Discriminant Analysis
Demo SAS implementation of Regularized (Linear) Discriminate Analysis of J. Friedman (1989)[1]. Simpler introduction can be found at [2]. Regularized QDA follows similarly.
To save coding, I called R within SAS to finish the computation. For details…
A SAS data miner without Enterprise Miner
SAS Enterprise Miner (EM) is indeed a fancy tool for a SAS programmer who wants to switch to the field of data mining. It is like the point-and-click camera: you drag several nodes onto the diagram, run it and everything is settled. And I was quite i…
The efficiency of five SAS methods in multi-dataset merging
Introduction: Merging two or multiple datasets is essential for many ‘data people’. Yes, it is a dirty and routine job. Everyone wants to get it done quick and accurate. Actually, SAS has many ways to tackle this job[3]. In two competing papers fro…
Rename all vars in a dataset using SASHELP
*Create a temporary dataset… DSN;data dsn;a=1;b=2;c=3;d=4;e=5;f=6;run;%macro test(lib,dsn);*/1)*/ data _null_;      set sashelp.vtable(where=(libname=”&LIB” and memname=”&DSN”));      call symput(‘nvars’,nvar);run;*/2)*/ data …
Multi-study research on Bovine respiratory disease
Situation:The purpose of this research was to (1) to explore a recent multi-study approach (Arends, et al. 2008) in combining observational survival data instead of traditional meta-analysis, and (2) to develop multivariate random-effects models with o…