1
votes

I need help in sas proc freq table.

I have two columns : TYPE and STATUS

TYPE has two values : TypeA and TypeB STATUS has two values : ON and OFF

I need the sas proc freq table output as follows :

--------------------------------------------------
| TYPE |         STATUS      |
--------------------------------------------------
|      | ON | OFF | ON | OFF |

--------------------------------------------------
| TypeA| 33 | 44 | 22  | 55  |
--------------------------------------------------
| TypeB| 11 | 22 | 33  | 44  | 
--------------------------------------------------

How can I obtain this ? I have tried:

proc freq data = XYZ; 
tables TYPE*STATUS/missing nocol norow nopercent nocum; 
run; 
1
proc freq data = XYZ; tables TYPE*STATUS/missing nocol norow nopercent nocum; run;Rikin
Please paste that into the question, not here - too hard to read in comments. Shall I assume your issue is that you don't know how to get the TOTAL column? Are you tied to PROC FREQ, or can we use PROC TABULATE ?Joe
I am sorry but I just changed the question table format. The above table displayed is what I am trying to get. Let me know if it is not clearRikin

1 Answers

2
votes

PROC TABULATE is probably the easiest way to get that total column. The keyword all gives you a total across a class.

proc tabulate data=xyz;
class type status;
tables type,(status all)*n;
run;