Hello community experts, Please assist me in understanding how to drop columns from my final output dataset table if the column has all equal test results. I have many SAS datasets that I use proc compare to find none equals and looking over them to find the columns of interest is tedious. (1 of table containing 881 variables and 3.2 million records, So the examples below have been modified for simplicity). proc compare base=&mydata. compare=&mydata_new. out=&mydata._&mydata_new.(drop=_TYPE_ _obs_) outnoequal;
by &var1. &var2. ;
run; After running proc compare has completed I obtain information much like the below example. Want 1: In this case example, I want the final dataset to only contain columns Anumber, Bnumber and V87 since V87 was the only column found to have differences. I want to drop columns V1 - V8 because they are all equal. Anumber Bnumber V1 V2 V3 V4 V5 V6 V7 V8 V87
1 A12 E E E E E E E E -1
2 A21 E E E E E E E E -5
3 B12 E E E E E E E E -1
4 B21 E E E E E E E E 1
5 B23 E E E E E E E E -1
6 C24 E E E E E E E E -1
7 C26 E E E E E E E E 1
8 C61 E E E E E E E E -1
9 D14 E E E E E E E E -1
10 D19 E E E E E E E E -5
11 D21 E E E E E E E E -5
12 D47 E E E E E E E E 1
13 D81 E E E E E E E E 1
14 D97 E E E E E E E E -1
15 D99 E E E E E E E E -1 Want 2: While in this 2nd case I want the final dataset to only contain columns Anumber, Bnumber, V3, V6 and V87 since these columns were found to have differences. I want to drop columns V1, V2, V4, V5, V7 and V8 because they are all equal. . Anumber Bnumber V1 V2 V3 V4 V5 V6 V7 V8 V87
1 A12 E E 2 E E E E E -1
2 A21 E E E E E E E E -5
3 B12 E E E E E 7 E E -1
4 B21 E E E E E E E E 1
5 B23 E E E E E E E E -1
6 C24 E E E E E E E E -1
7 C26 E E E E E E E E 1
8 C61 E E E E E E E E -1
9 D14 E E E E E E E E -1
10 D19 E E E E E E E E -5
11 D21 E E E E E E E E -5
12 D47 E E E E E E E E 1
13 D81 E E E E E E E E 1
14 D97 E E E E E E E E -1
15 D99 E E E E E E E E -1 As a note the true variable names are not in the form of V1, V87, but are more like first_name, Last_name, DOB, Gender...… How can I achieve my wants using SAS?
... View more