1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
data bdd;
input ID A B C Sal ;
datalines;
01 1 0 0 1600
02 1 0 0 2599
03 1 1 0 1293
04 0 1 0 1865
05 1 1 0 1653
06 1 0 1 1343
07 0 1 1 1657
08 0 0 1 2431
09 0 0 1 3421
10 1 1 1 3421
;
run;
data bdd1;
set bdd;
array n(3) a b c;
if n(1)=1 and n(2)=0 and n(3)=0 then temp1=1;
if n(2)=1 and n(1) =0 and n(3)=0 then temp2=1;
if n(3)=1 and n(1) =0 and n(2)=0 then temp3=1;
if n(1)=1 and n(2)=1 and n(3)=0 then temp4=1;
if n(1)=1 and n(3)=1 and n(2)=0 then temp5=1;
if n(2)=1 and n(3)=1 and n(1)=0 then temp6=1;
if (1)=1 and n(2)=1 and n(3)=1 then temp7=1;
run;
proc sql;
create table bdd2 as select
sum(temp1) as g1,sum(temp2) as g2
,sum(temp3) as g3,sum(temp4) as g4,
sum(temp5) as g5,sum(temp6) as g6,
sum(temp7) as g7
from bdd1
;
QUIT;
proc transpose data=bdd2 out=bdd3 (rename=(_name_=Groupe col1=Nombre_obs));run; |
Partager