This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*--------------------------------------------------------------*/ | |
/* Index and Double-set */ | |
/*--------------------------------------------------------------*/ | |
/* This example is to demonstrate the use of proc datasets */ | |
/* (index) and double-set. */ | |
/* */ | |
/*--------------------------------------------------------------*/ | |
/* The first data set TRANSACTION is a lookup table. */ | |
/* The second data set MASTER is to get multiple */ | |
/* observations per lookup observation. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* generate random categorical variables; | |
%macro setcat(indsn=, outdsn=, rn=, varname=, len=40, cat=, ncat=); | |
data copy; | |
set &indsn; | |
seq = _n_; | |
run; | |
* put the number of each category in ncat1, ncat2,...ncati, count the total number of categories; | |
%let i = 1; | |
%do %while (%cmpres(%scan(&ncat., &i., "|")) ne ); | |
%let ncat&i. = %cmpres(%scan(&ncat., &i., "|")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* create random number in a dataset according to its obs; | |
%macro setr(indsn=, outdsn=, rn=); | |
%let dsid = %sysfunc(open(&indsn)); | |
%global nobs; | |
%let nobs = %sysfunc(attrn(&dsid, nlobs)); | |
%let rc = %sysfunc(close(&dsid)); | |
data tem; | |
set &indsn; | |
rnum&rn = _n_; | |
run; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************************************************* | |
Project: BAN-AA-01 | |
Program: s_dm | |
Des: To generate SDTM DM; | |
Input: | |
Output: | |
Programmer: Ray (Hang Zhong) | |
Created: | |
QCer: | |
QC date: 11/15/2012 |