## PROC FREQ or PROC TABULATE for complex table

Frequent Contributor
Posts: 142

# PROC FREQ or PROC TABULATE for complex table

[ Edited ]

Hi all,

Could you please say how to implement Proc Freq for the following case. I have the table below:

and I need to build the following statistics (frequencies):

What shoult be the format of PROC FREQ? Or should it be PROC TABULATE? I am looking for a decision in several steps but can it be sorted out in one?

I have attached the datalines for your conveniencies:

``````data test;
length Patient \$1 Examination \$7 Visit1Finding	Visit2Finding Cohort \$1;
infile datalines dlm='	';
input Patient Examination Visit1Finding	Visit2Finding Cohort;
datalines;
1	SKIN	N	N	1
1	ABDOMEN	N	N	1
2	SKIN	Y	N	2
2	ABDOMEN	N	Y	2
3	SKIN	N	Y	1
3	ABDOMEN	N	Y	1
4	SKIN	N	Y	2
4	ABDOMEN	N	Y	2
5	SKIN	Y	Y	1
5	ABDOMEN	N	Y	1
6	SKIN	N	Y	2
6	ABDOMEN	N	Y	2
7	SKIN	N	Y	1
7	ABDOMEN	N	Y	1
8	SKIN	N	Y	1
8	ABDOMEN	N	Y	1
;
run;``````

Thank you.

Super User
Posts: 5,518

## Re: PROC FREQ or PROC TABULATE for complex table

How does Visit2Finding get utilized in constructing the table?

PROC FREQ can give you something quick and dirty, not at all fancy and only similar to what you asked for:

proc freq data=have;

tables examination * visit1Finding * cohort / missing list;

run;

You might add Visit2Finding in there somewhere, depending on what it is supposed to be used for.

For anything fancier, you probably need to switch to PROC TABULATE.

Frequent Contributor
Posts: 142

## Re: PROC FREQ or PROC TABULATE for complex table

[ Edited ]

I have received the following table:

but badly need exactly the one below (. Is it possible to use Proc Report and what is the algorythm for it?

Super User
Posts: 11,343