PROC FREQ - Suppress repetition of variables

Accepted Solution Solved
Reply
Contributor
Posts: 50
Accepted Solution

PROC FREQ - Suppress repetition of variables

Hi all


I am calculating frequency for a 3 way table using the following following PROC FREQ:

FREQ.JPG

My frequency is getting printed correctly. But I have couple of values getting repeated in my report for EC2 and BU.

freq1.JPG

As you can see, the value EC2 and BU got repeated. I understand that along with SRCELN all three make a unique combination. But I would like to know if we have any way to suppress the repetitive information?

Also instead of PROC FREQ, can we use any other PROC to generate similar frequency report as desired.

Any help would be greatly appreaciated. Thanks.


Accepted Solutions
Solution
‎10-21-2013 04:00 PM
Super User
Posts: 19,869

Re: PROC FREQ - Suppress repetition of variables

That's the default set up for Proc Tabulate - for the HTML output anyways, which is what you've pasted above.

proc freq data=sashelp.heart;

table status*sex*smoking/list;

run;

proc tabulate data=sashelp.heart;

    class status sex smoking;

    table status*sex*smoking, n;

run;

View solution in original post


All Replies
Super User
Posts: 19,869

Re: PROC FREQ - Suppress repetition of variables

What would you like it to look like?

Other procs are proc report and tabulate.

Contributor
Posts: 50

Re: PROC FREQ - Suppress repetition of variables

Any proc that can help me bringing the 3 cross tabulated output like this. As I said, the repetitive values shouldn't be printed.

Also if you could give some pointers on using PROC REPORT or PROC TABULATE for such a 3 cross report, it would be quite useful.

Super User
Posts: 19,869

Re: PROC FREQ - Suppress repetition of variables

What do you mean by "Not Printed"? Is that just a blank instead or excluded?

Show what your output should look like?

Contributor
Posts: 50

Re: PROC FREQ - Suppress repetition of variables

Just a blank for the repetition, not excluding. Frequency alone must be present.

Somethign like this:

18 17000 201112   1

                201118 36

Solution
‎10-21-2013 04:00 PM
Super User
Posts: 19,869

Re: PROC FREQ - Suppress repetition of variables

That's the default set up for Proc Tabulate - for the HTML output anyways, which is what you've pasted above.

proc freq data=sashelp.heart;

table status*sex*smoking/list;

run;

proc tabulate data=sashelp.heart;

    class status sex smoking;

    table status*sex*smoking, n;

run;

Contributor
Posts: 50

Re: PROC FREQ - Suppress repetition of variables

Awesome ! PROC TABULATE prefectly worked! Thank you so much!

Super User
Posts: 19,869

Re: PROC FREQ - Suppress repetition of variables

proc tabulate data=sashelp.heart;

    class status sex smoking;

    table status*sex*smoking, n='Frequency';

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 264 views
  • 3 likes
  • 2 in conversation