Hi all,
I am getting multiple instances of same values when I use proc means to sum up by 2 variables , say gender and age but I am getting 4 age groups and same summed up value. I there a way to debug this.
Thanks,
Raj
********************************************************;
proc freq data = A noprint; tables participants*sex*age_r/ list missing nocol norow nopercent nocum out=X;run;
*****************************************************;
proc sort data = A; by participants age_r sex ;
proc means data = A n noprint sum;
by participants age_r sex ;
var g b;
output out= B(drop=_type_ _freq_)
sum(b)= b
sum(g)= a ;
proc print data=B;id sex ;var a b;run;
********************************************************;
proc sort data=X ;by sex age_r;
proc sort data=B;by sex age_r;
data age_sex; merge X(in=a ) B(in=b);
by sex age_r ;
*********************************************************;
proc print data=age_sex;id sex ; var age_r count a b;
*********************************************************;
I am getting multiple instances of same values when I use proc means to sum up by 2 variables , say gender and age but I am getting 4 age groups and same summed up value. I there a way to debug this.
Thanks,
Raj
********************************************************;
proc freq data = A noprint; tables participants*sex*age_r/ list missing nocol norow nopercent nocum out=X;run;
*****************************************************;
proc sort data = A; by participants age_r sex ;
proc means data = A n noprint sum;
by participants age_r sex ;
var g b;
output out= B(drop=_type_ _freq_)
sum(b)= b
sum(g)= a ;
proc print data=B;id sex ;var a b;run;
********************************************************;
proc sort data=X ;by sex age_r;
proc sort data=B;by sex age_r;
data age_sex; merge X(in=a ) B(in=b);
by sex age_r ;
*********************************************************;
proc print data=age_sex;id sex ; var age_r count a b;
*********************************************************;