Have an interesting SAS Question and if it can be done in proc report . The input dataset looks like this :
name | col1 | percent1 | col2 | percent2 |
abc | 45 | 0.12 | 56 | 0.32 |
def | 34 | 0.25 | 45 | 0.80 |
Output report needed on a pdf document with the name variable as by variable on separate pages like this : used byvalue() option on the title but columns are not getting transposed to desired format. Any help is highly appreciated. thanks in advance
title >>>>> | byname - abc | page1 | ||
column_header | percent_header | |||
col1 | 45 | 12% | ||
col2 | 56 | 25% |
title >>>>> | byname - def | page2 | ||
column_header | percent_header | |||
col1 | 34 | 25% | ||
col2 | 45 | 80% |
Basically I am trying to align columns as rows with description.
Have an interesting SAS Question and if it can be done in proc report . The input dataset looks like this :
name | col1 | percent1 | col2 | percent2 |
abc | 45 | 0.12 | 56 | 0.32 |
def | 34 | 0.25 | 45 | 0.80 |
Output report needed on a pdf document with the name variable as by variable on separate pages like this : used byvalue() option on the title but columns are not getting transposed to desired format. Any help is highly appreciated. thanks in advance
title >>>>> | byname - abc | page1 | ||
column_header | percent_header | |||
col1 | 45 | 12% | ||
col2 | 56 | 25% |
title >>>>> | byname - def | page2 | ||
column_header | percent_header | |||
col1 | 34 | 25% | ||
col2 | 45 | 80% |
Basically I am trying to align columns as rows with description.
Hi:
By default, PROC REPORT will not "stack" variables as you envision. You would have to restructure the data to use PROC REPORT. Then, you can either use BY group processing or COMPUTE BEFORE _PAGE_ to get the type of header you want. I show the NAME variable column on my screen shot just so you can see how it is used. But if you did not want to see name, you could always use NOPRINT on the DEFINE statement for NAME.
cynthia
Hi:
You haven't posted any code or any data so it's hard to envision how you're using ODS LAYOUT and ODS REGION to do this. #BYVAR and #BYVAL are designed to work in a SAS title only. So there are not many other places where you can use those tokens. They are treated as text every place else.
In your original post, you showed the BY group tables one under the other, as though each one was on a separate page. If you are using PDF, you can frequently get small tables placed side by side merely by using COLUMNS=2, as shown here: https://communities.sas.com/t5/SAS-Procedures/Show-additional-information-in-tabular-cells/td-p/2930... scroll down to the post that shows 2 tables side by side created with PROC REPORT.
cynthia
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.