Example 3.9 Generating Every Combination of Rows (Cartesian Product) between Tables
Combine two tables that have no common columns in order to produce every possible combination of rows.
|Featured Step||PROC SQL|
|Featured Step Options and Statements||Cartesian product|
|Related Technique||DATA step, multiple SET statements, NOBS= and POINT= options|
Table TRIAL_A has the identifiers for a group of patients who are participating in a clinical trial. Table TRIAL_TESTS contains the lab tests for this trial. There are no columns in common between the two tables.
TRIAL_A Obs patientid patientinits 1 KPGY AHB 2 MWGM DOH 3 PQZU LRH 4 FQ82 HCI 5 EYPS MEF TRIAL_TESTS Obs testcode testtype 1 L001 Cholesterol 2 L002 Glucose 3 ...