BookmarkSubscribeRSS Feed
deleted_user
Not applicable
My issue is I am trying to create a report (using PROC REPORT), output to either PDF or RTF. The style I'm using is journal but what I would like to do is to stack them differently and make a line between groupings. I can get the line the way I want it in the output screen but not on my ODS output, and I can't figure out how to get the two columns stacked. What am I doing wrong?


My report currently outputs this way (it's more indented but I can't replicate the output here)

CURRENT ISSUES Q1. LOCATION RATED A 5
Q2. RESOURCES RATED A 3
FUTURE ISSUES Q3. SUPPLY RATED A 9


What I would like the output to look like is this (if possible with a line or space between the two headings).


CURRENT ISSUES
Q1. Locations Rated a 5
Q2. Resources Rated a 3
----------------------------------
FUTURE ISSUES
Q3. Supply Rated a 9
Q4. Demand Rated a 3
-------------------------------------
Q6. Overall Summary Rated a 5


Any suggestions? Thanks so much for the help.


Paula
3 REPLIES 3
Tim_SAS
Barite | Level 11
Can you show us some of the code you're using to produce the report?
deleted_user
Not applicable
Here's some general code that produces output similar to what I am currently getting. As mentioned before, it "works" on the output screen but not in the RTF output.

Thanks again
Paula

******************************************


DATA ORIGINAL;
SET SASHELP.PRDSAL2;
RUN;

PROC SQL;
CREATE TABLE NEW2 AS
SELECT COUNTRY,
STATE,
SUM(ACTUAL) AS ACTUALX,
SUM(PREDICT) AS PREDICTEDX
FROM ORIGINAL
GROUP BY COUNTRY, STATE;
QUIT;
RUN;


OPTIONS nodate
nonumber
missing = " "
orientation = landscape
papersize = legal
leftmargin = .5in
rightmargin = .15in
nobyline;
RUN;

ODS RTF file= 'C:\TEST.RTF' style = JOURNAL;
PROC REPORT DATA = new2 NOWD LS = 255 SPLIT = '*' ;
TITLE height = 18pt
"Country Summary ";
COLUMN Country
State
Actualx Predictedx;
DEFINE COUNTRY / GROUP;
DEFINE STATE / GROUP;
DEFINE ACTUALX / "Actual Cost";
Define Predictedx / "Predicted Cost";
break after country / ul skip;
run;
ODS RTF CLOSE;
Tim_SAS
Barite | Level 11
Paula,

First, I apologize for such a delayed response. Somehow I missed that you had updated this topic.

The reason you see a line between each group of states on the Output window and not in RTF is that the UL option only affects "traditional monospace output," not RTF, PDF, etc. This is of course because UL really means "a bunch of dashes" which isn't very meaningful to or attractive in modern output formats. What would be meaningful and attractive would be a "text_decoration=underline" style attribute (or something similar) but that's not available in 9.1.3. However, you said a space between groups would be okay and you can do that by using a COMPUTE block to print a blank line after each group of states.

Also (if I understand correctly) you want the Country values to appear directly above the State values. Again, you can use a COMPUTE block to print the value of Country (left-justified and in the same style as the state values) before each group of states. Since the Country value is displayed courtesy of a LINE statement, you will need to suppress the normal display of the Country column by adding NOPRINT to Country's DEFINE statement.

Here's your code with the changes I've suggested. Please let me know if this works for you, and I'll try to figure out how to get this forum software to tell me when you update the thread.

PROC REPORT DATA = new2 NOWD LS = 255 SPLIT = '*' ;
TITLE height = 18pt
"Country Summary ";
COLUMN Country
State
Actualx Predictedx;
DEFINE COUNTRY / GROUP noprint;
DEFINE STATE / GROUP;
DEFINE ACTUALX / "Actual Cost";
Define Predictedx / "Predicted Cost";
compute before country / style=data {just=l};
line country $22.;
endcomp;
compute after country;
line ' ';
endcomp;
run;

sas-innovate-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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