Hello all; I want a macro or program that allows retain those observations that meet the following conditions:: 1- if the frequencies of "variable1" are greater than or equal to 3; and 2- if the frequencies of variable2 are greater than or equal to 3; Frequency=Number (n) of records of that variable. Here is an example of my data file: data have;
input id $ variable1 $ variable2 $;
datalines;
9914089 100689 81999
9914096 9613166 81999
9914108 100671 91996
9914115 100690 91999
9914119 100690 91996
9914124 9512799 91996
9914130 100671 91996
9914136 9512799 91996
9914137 9512782 72005
9914148 9613166 72005
9914158 100690 91999
9914163 100671 91999
9914164 9512799 91999
;
run; In this case, the observations to be retained would be: data want;
input id $ variable1 $ variable2 $;
datalines;
9914108 100671 91996
9914115 100690 91999
9914119 100690 91996
9914124 9512799 91996
9914130 100671 91996
9914136 9512799 91996
9914158 100690 91999
9914163 100671 91999
9914164 9512799 91999
;
run; I want a program that checks the two conditions simultaneously (loop?), But I do not know how to do it. It is complex, because the frequencies are conditioned. That is, to delete or to retein by the 1st condition (by frequencies of variable1), the frequencies of variable2 change (condition 2). How could I do it? Thanks! Alan
... View more