🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Meteorite | Level 14

## freq for each day and reports located side by side

Hello

What is the way to create such report when for each day there is freq report by 3 fields: X1,X2,X3.

For each day we need to see the fields names and categories names and need to have a black column as a gap between days.

``````Data rawtbl;
input ID date : date9. x1 \$ x2  \$ x3 \$ ;
cards;
1 01jan2021 a a b
2 01jan2021 b c b
3 01jan2021 c a b
4 01jan2021 a c c
5 02an2021 b b b
6 02an2021 a c b
7 03jan2021 c a b
8 03jan2021 a b b
9 03jan2021 a a c
;
run;``````

1 ACCEPTED SOLUTION

Accepted Solutions
Garnet | Level 18

## Re: freq for each day and reports located side by side

Check next code:

``````Data rawtbl;
input ID date : date9. x1 \$ x2  \$ x3 \$ ;
format date ddmmyy10.;
cards;
1 01jan2021 a a b
2 01jan2021 b c b
3 01jan2021 c a b
4 01jan2021 a c c
5 02jan2021 b b b
6 02jan2021 a c b
7 03jan2021 c a b
8 03jan2021 a b b
9 03jan2021 a a c
;
run;

proc format lib=work;
value \$catg
'a' = 'x_a'
'b' = 'x_b'
'c' = 'x_c'
; run;
data to_rep;
set rawtbl;
length category \$3;
category = put(x1,\$catg.); field='x1'; freq=1; output;
category = put(x2,\$catg.); field='x2'; freq=1; output;
category = put(x3,\$catg.); field='x3'; freq=1; output;
drop x1 - x3;
run;
proc tabulate data=to_rep;
class date field category;
var freq;
table field*category,
date*freq*sum=' ';
run;``````
Garnet | Level 18

## Re: freq for each day and reports located side by side

Check next code:

``````Data rawtbl;
input ID date : date9. x1 \$ x2  \$ x3 \$ ;
format date ddmmyy10.;
cards;
1 01jan2021 a a b
2 01jan2021 b c b
3 01jan2021 c a b
4 01jan2021 a c c
5 02jan2021 b b b
6 02jan2021 a c b
7 03jan2021 c a b
8 03jan2021 a b b
9 03jan2021 a a c
;
run;

proc format lib=work;
value \$catg
'a' = 'x_a'
'b' = 'x_b'
'c' = 'x_c'
; run;
data to_rep;
set rawtbl;
length category \$3;
category = put(x1,\$catg.); field='x1'; freq=1; output;
category = put(x2,\$catg.); field='x2'; freq=1; output;
category = put(x3,\$catg.); field='x3'; freq=1; output;
drop x1 - x3;
run;
proc tabulate data=to_rep;
class date field category;
var freq;
table field*category,
date*freq*sum=' ';
run;``````
Discussion stats