The SAS Output Delivery System and reporting techniques

Interesting Report Question

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Interesting Report Question

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.


Accepted Solutions
Solution
‎08-30-2016 12:09 PM
SAS Super FREQ
Posts: 8,739

Re: SAS Interesting Report Problem

Hi:
You only need to post this one time, to prevent multiple people from working on the same question in different forums.
One suggestion is already posted here:
https://communities.sas.com/t5/ODS-and-Base-Reporting/Interesting-Report-Question/m-p/294989

cynthia

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,739

Re: Interesting Report Question

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

restructure_for_report.png

Contributor
Posts: 35

SAS Interesting Report Problem

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.

Solution
‎08-30-2016 12:09 PM
SAS Super FREQ
Posts: 8,739

Re: SAS Interesting Report Problem

Hi:
You only need to post this one time, to prevent multiple people from working on the same question in different forums.
One suggestion is already posted here:
https://communities.sas.com/t5/ODS-and-Base-Reporting/Interesting-Report-Question/m-p/294989

cynthia
Contributor
Posts: 35

Re: Interesting Report Question

I am trying to use ods layout with ods region as a way to show the output instead of title approach. However not sure if we can use byvar/byval option as in title for proc report .secondly how can we print the output side by side on a same page .
SAS Super FREQ
Posts: 8,739

Re: Interesting Report Question

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

☑ This topic is SOLVED.

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

Discussion stats
  • 5 replies
  • 483 views
  • 3 likes
  • 2 in conversation