Very new to this, need to formulate a missing value pattern table in SAS. Let me explain.
data test;
input landval improval totval salepric saltoapr city $6. season $8. truefalse;
datalines;
30000 64831 94831 118500 1.25 A spring 1
30000 50765 80765 93900 . winter 0
46651 18573 65224 . 1.16 B 1
45990 91402 . 184000 1.34 C winter 1
42394 . 40575 168000 1.43 0
. 3351 51102 169000 1.12 D winter 0
63596 2182 65778 . 1.26 E spring 1
56658 53806 10464 255000 1.21 0
51428 72451 . . 1.18 F spring 0
93200 . 4321 422000 1.04 1
76125 78172 54297 290000 1.14 G winter 1
. 61934 16294 237000 1.10 H spring 0
65376 34458 . 286500 1.43 winter 1
42400 . 57446 . . K 0
40800 92606 33406 168000 1.26 S 0
;
run;
There are missing values in the above table, except for the column truefalse. If i create a missing pattern data like this
data miss_pattern (drop=i);
set test;
array mynum(*) _numeric_;
do i=1 to dim(mynum);
if mynum(i) =. then mynum{i}=1;
else mynum(i)=0;
end;
array mychar(*) $ _character_;
do i=1 to dim(mychar);
if mychar(i) ="" then mychar{i}=1;
else mychar(i)=0;
end;
run;
proc freq data=miss_pattern;
tables landval*improval*totval*salepric*saltoapr*city*season /list;
run;
I get the desired output, except i would like to add a column in this table called "number of truefalse = 1"
which would tell me how many combinations had the value 1 for that column in the original table. Any minor changes to the code that I can make?
... View more