1
votes

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?

1
Can you post the proc report code you've tried, that didn't work?Reeza
Or do you think we can do total first, then gender part. And then append it?Latife
Please add the code to the question via an edit rather than the comments.Reeza
I added, please check and let me know. How can I find that solution. Please. Thank you so much @ReezaLatife
Your data doesn't match your output, you have 2013. I think your expectations of what to expect in terms of time for answers is high. This is a volunteer forum, people answer as they have time and desire. As a personal choice, I avoid questions with high urgency.Reeza

1 Answers

0
votes

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;