Latife
Latife

Reputation: 15

Proc report- grouping

I have an easy table, and I need to create a complicated report. I tried to do it with proc report using lots of grouping but didn't give me right result. Here is my example table :

 campus   id    year   gender
  West    35    2013    F
  West    35    2014    F
  West    35    2015    F
  West    38    2014    M
  West    38    2015    M
  East    48    2014    -
  East    48    2015    -
  East    55    2013    F
  East    55    2014    F 

And this is the report I need to create:

               west             east    
           2014   2015      2014    2015
    total     2      2        2      1

    Gender    2      2        2      1
     F        1      1        1      -
     M        1      1        -      - 
     none     -      -        1      1

So I have 4 different group: I worked on this code

  proc tabulate data=a ; 
 class gender year ; 
  table gender, year*n*f=4. ; 
   by id;
   run ; 

Do you think I can do total first, then gender. And tehn I can append them?

Upvotes: 1

Views: 136

Answers (1)

Reeza
Reeza

Reputation: 21274

This doesn't quite match your requested output, but I'm not sure having the total repeated makes sense either. Proc Tabulate works well here:

proc tabulate data=have;
class campus year gender/missing;
table (all='Total' gender='Gender'), campus=''*year=''*n='';
run;

Upvotes: 0

Related Questions