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

## Proc report - Long instead of wide

Hi everyone,

I'm trying to create a report using PROC Report:

Here is the data and code:

data dataexercise;
input Week @@ Status \$;
datalines;
1 Accept
2 Accept
3 Accept
4 Accept
1 Reject
2 Reject
3 Accept
4 Accept
1 Accept
2 Accept
3 Accept
4 Accept
;
run;

proc tabulate data=dataexercise;
class week Status ;
table
week*Status;
run;

Instead of the weeks going horizontally. This is what I would like:

 Week Accept Reject 1 2 1 2 2 1 3 3 0 4 3 0

Any help would be greatly appreciated!

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Proc report - Long instead of wide

@hwangnyc wrote:
Hi Ballardw,

THANK YOU! This is perfect. Can you tell me how I can sum across the rows?
```proc tabulate data=dataexercise;
class week Status ;
table
week=' ',
Status=' ' All='Row total'
/box=week;
run;```

will do a row count total for all records in the week

```proc tabulate data=dataexercise;
class week Status ;
table
week=' ' all='Column Total',
Status=' '
/box=week;
run;```

Will do the total across the weeks and;

```proc tabulate data=dataexercise;
class week Status ;
table
week=' ' all='Column Total',
Status=' ' all='Row Total'
/box=week;
run;```

Will provide a total of both row and column.

All can be used in parentheses to  work with different groups of values.

Be aware that Proc Tabulate by default will only include records that have values for all of the Class variables by default.

3 REPLIES 3
Super User

## Re: Proc report - Long instead of wide

```proc tabulate data=dataexercise;
class week Status ;
table
week=' ',
Status=' '
/box=week;
run;```

The comma is used in tabulate to separate the role from page, row or column. With only two dimensions the first is row, and second is column. The =' ' suppresses the variable label and the /box= option places the label of the variable Week inside the upper left corner of the table.

Quartz | Level 8

## Re: Proc report - Long instead of wide

Hi Ballardw,

THANK YOU! This is perfect. Can you tell me how I can sum across the rows?
Super User

## Re: Proc report - Long instead of wide

@hwangnyc wrote:
Hi Ballardw,

THANK YOU! This is perfect. Can you tell me how I can sum across the rows?
```proc tabulate data=dataexercise;
class week Status ;
table
week=' ',
Status=' ' All='Row total'
/box=week;
run;```

will do a row count total for all records in the week

```proc tabulate data=dataexercise;
class week Status ;
table
week=' ' all='Column Total',
Status=' '
/box=week;
run;```

Will do the total across the weeks and;

```proc tabulate data=dataexercise;
class week Status ;
table
week=' ' all='Column Total',
Status=' ' all='Row Total'
/box=week;
run;```

Will provide a total of both row and column.

All can be used in parentheses to  work with different groups of values.

Be aware that Proc Tabulate by default will only include records that have values for all of the Class variables by default.

Discussion stats
• 3 replies
• 808 views
• 0 likes
• 2 in conversation