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

Good day all,

 

I have a report with me in sas format which needs to be formatted to the sample provided. 

The sample report is - 

 

data bike;
input bike $ sales engine comp stock;
datalines;
A 1 1 23 30
B 4 3 21 27
Tot_med 5 4 44 57
C 4 3 27 21
D 5 2 31 36
Tot_sup 6 34 58 57

;

 

I want the final report to look like the attached format.  

 

Can someone please suggest and guide how it can be achieved in Proc Report.  

 

Also, if it can be done in any other SAS procedure more easily. Please suggest.  

 

Regards,

Rishi 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@75063 wrote:

Thank you for your reply and I stand corrected that I should have mentioned that I want the reports to come one after the other in the order.  

 

I still have a doubt.

 

What if my two reports came from two entirely different data-sets having no common variables in the two reports. 

 

Can i still have the output of the reports in the same page one after the other with two blank spaces in them? 


You can control that. As long as the tables can fit on the page you can set it up that way. In ODS PDF you would use STARTPAGE to control when a new page is started. I’m not sure how to control the number of spaces between the tables, in ODS TAGSETS.EXCELXP you would use the SKIP_SPACE option to control the spacing between tables. If a similar option isn’t available for the destination you’re using you can try ODS LAYOUT and ODS DOCUMENT or PROC TEMPLATE but that adds another level of complexity to your reports. 

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

There is no report sample shown. If you choose to attach a report, it should not be in Microsoft Office (Word, Excel Powerpoint) format as these are considered security risks. Use PDF or TXT or PNG or GIF.

--
Paige Miller
75063
Obsidian | Level 7

Thank you for the clarification regarding attaching the report format. I have attached a pdf format now.  

 

 

Reeza
Super User

1. Rather than include summaries in your data, I would let the PROC REPORT/PRINT do that instead

2. Add a grouping variable so that you know the first two records belong to the MED group and the last two to the SUP group. 

3. Try with PROC PRINT - SUM statement. If that doesn't meet your needs then move on to the PROC REPORT option. 

4. PROC REPORT with a RBREAK and SUMMARIZE option. See some of the examples here with code:

http://www2.sas.com/proceedings/sugi27/p120-27.pdf

75063
Obsidian | Level 7
Is it possible to concatenate two or more proc reports?
Reeza
Super User

@75063 wrote:
Is it possible to concatenate two or more proc reports?

 

What do you mean by concatenate?

 

They can come one after the other in the output. 

 

You can split a data set into distinctive sections using BY or BREAK statements depending on your needs. 

 

 

75063
Obsidian | Level 7

Thank you for your reply and I stand corrected that I should have mentioned that I want the reports to come one after the other in the order.  

 

I still have a doubt.

 

What if my two reports came from two entirely different data-sets having no common variables in the two reports. 

 

Can i still have the output of the reports in the same page one after the other with two blank spaces in them? 

Reeza
Super User

@75063 wrote:

Thank you for your reply and I stand corrected that I should have mentioned that I want the reports to come one after the other in the order.  

 

I still have a doubt.

 

What if my two reports came from two entirely different data-sets having no common variables in the two reports. 

 

Can i still have the output of the reports in the same page one after the other with two blank spaces in them? 


You can control that. As long as the tables can fit on the page you can set it up that way. In ODS PDF you would use STARTPAGE to control when a new page is started. I’m not sure how to control the number of spaces between the tables, in ODS TAGSETS.EXCELXP you would use the SKIP_SPACE option to control the spacing between tables. If a similar option isn’t available for the destination you’re using you can try ODS LAYOUT and ODS DOCUMENT or PROC TEMPLATE but that adds another level of complexity to your reports. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1432 views
  • 1 like
  • 3 in conversation