Changeset 20895 in main
 Timestamp:
 06/28/20 12:36:00 (11 days ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

adopters/mt/trunk/src/main/backend_qModules/birth23/MT_Count_data_frame.def
r19744 r20895 86 86 * the numerator and denominator counts for the cell suppression. ; 87 87 *****************************************************************; 88 %let flag=0; 89 ?popcross1? %let flag=1; 90 ?popcross2? %let flag=1; 91 ?popcross1? ?popcross2? %let flag=2; 92 93 %macro popcross; 94 95 %if &flag=0 %then %do; 96 proc summary data=poptmp; 97 var popcount; 98 output out=pop sum=popcount; 99 run; 100 proc sql; 101 create table tmp1 as 102 select tmp.*, pop.* 103 from tmp, pop 104 quit; 105 %end; 106 107 %if &flag=1 %then %do; 108 proc summary data=poptmp; 109 var popcount; 110 class %popcross1% %popcross2%; 111 output out=pop sum=popcount; 112 run; 113 data pop; 114 set pop; 115 rename 116 ?popcross1? %popcross1%=%cross1% 117 ?popcross2? %popcross2%=%cross2% 118 ; 119 drop _TYPE_ _FREQ_ ; 120 run; 121 proc sort data=pop; 122 ?popcross1? by %cross1%; 123 ?popcross2? by %cross2%; 124 run; 125 proc sort data=tmp; 126 ?popcross1? by %cross1%; 127 ?popcross2? by %cross2%; 128 run; 129 proc print data=pop noobs; title2 '3. POP  pop dataset'; run; 130 data tmp1; 131 merge tmp pop; 132 ?popcross1? by %cross1%; 133 ?popcross2? by %cross2%; 134 run; 135 %end; 136 137 %if &flag=2 %then %do; 138 proc summary data=poptmp; 139 var popcount; 140 class %popcross1% %popcross2% ; 141 output out=pop sum=popcount; 142 run; 143 data pop; 144 set pop; 145 rename %popcross1%=%cross1% %popcross2%=%cross2% ; 146 run; 147 proc sort data=pop; 148 by %cross1% %cross2%; 149 run; 150 proc sort data=tmp; 151 by %cross1% %cross2%; 152 run; 153 data tmp1; 154 merge tmp pop; 155 by %cross1% %cross2% 156 ; 157 run; 158 %end; 159 %mend; 160 %popcross; 88 %let flag=0; 89 ?popcross1? %let flag=1; 90 ?popcross2? %let flag=1; 91 ?popcross1? ?popcross2? %let flag=2; 92 93 %macro popcross; 94 95 %if &flag=0 %then %do; 96 proc summary data=poptmp; 97 var popcount; 98 output out=pop sum=popcount; 99 run; 100 proc sql; 101 create table tmp1 as 102 select tmp.*, pop.* 103 from tmp, pop 104 quit; 105 %end; 106 107 %if &flag=1 %then %do; 108 proc summary data=poptmp; 109 var popcount; 110 class %popcross1% %popcross2%; 111 output out=pop sum=popcount; 112 run; 113 proc sql; 114 create table tmp1 as 115 select tmp.*, pop.* 116 from tmp left join pop 117 on 118 ?popcross1? tmp.%cross1%=pop.%popcross1%; 119 ?popcross2? tmp.%cross2%=pop.%popcross2%; 120 quit; 121 %end; 122 123 %if &flag=2 %then %do; 124 proc summary data=poptmp; 125 var popcount; 126 class %popcross1% %popcross2% ; 127 output out=pop sum=popcount; 128 run; 129 proc sql; 130 create table tmp1 as 131 select tmp.*, pop.* 132 from tmp left join pop 133 on tmp.%cross1%=pop.%popcross1% and 134 tmp.%cross2%=pop.%popcross2%; 135 quit; 136 %end; 137 %mend; 138 %popcross; 139 proc print data=tmp1 noobs; title2 '3. tmp1  tmp merged with pop dataset'; 161 140 162 141
Note: See TracChangeset
for help on using the changeset viewer.