Comparing Two Data Sets When Some Variables Are Not in Both Data Sets

PROC COMPARE can also be used to compare selected variables between two data sets. Suppose you have one data set that contains demographic information on each patient in a clinical trial (DEMOG). In addition, you have another file from a previous study that contains some of the same patients and some of the same demographic information (OLDDEMOG). Program 7-6 creates these sample data sets.

Program 7-6. Creating Two Test Data Sets, DEMOG and OLDDEMOG
***Program to create data sets DEMOG and OLDDEMOG; DATA DEMOG; INPUT @1 PATNO 3. @4 GENDER $1. @5 DOB MMDDYY10. @15 HEIGHT 2.; FORMAT DOB MMDDYY10.; DATALINES; 001M10/21/194668 003F11/11/105062 004M04/05/193072 006F05/13/196863 ...

Get Cody’s Data Cleaning Techniques Using SAS® Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.