简体   繁体   中英

SAS proc freq table

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; 

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM