BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mega
Fluorite | Level 6

Hi all, 

I produce weekly safety listings for a study that has some extremely long text entries. I realize this is not ideal but we do not handle the database for this one and I have no control over how the clinical sites enter data. The issue I'm having is that PROC REPORT cuts off some of these very long entries (current variable length is $1375) and I'm not having a lot of luck figuring out if it's possible to have a single row span two pages using the RTF destination. I could possibly use a different output destination. I have removed the L/R margins and squished the other column widths to barely readable to give this one more room, but it's still not enough. Any ideas are appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

I tested with ODS RTF and ODS PDF, making a character variable of length $9000, with the actual length coming in at 8806 characters. Too much to fit on 1 page in RTF. I just used 1 obs from SASHELP.CLASS to dummy up some data. Basically my REALLY_LONG variable contains some lines from Jabberwocky that I repeated 30 times with a number in front of each repeat so I could make sure that the entire value was getting displayed in Word and Acrobat Reader. Here's the code I used:

Cynthia_sas_0-1674695172350.png

Notice that I put some line breaks in just to mimic some large text paragraphs. I used ODS ESCAPECHAR for the line breaks. Also part of making this work was using the NOTRKEEP option, which told Word, that a table row could split across pages. Without the option, it looked like the long text was just getting truncated. Also, I changed the orientation to landscape and made the margins .25 inch all around.

  I'm still not entirely clear on what you wanted to do with your page breaks, but this example shows that I got all 30 "chunks" of Jabberwocky into the column for the REALLY_LONG variable and the row could break across a page, as shown below:

Cynthia_sas_1-1674695357978.png

I highlighted the first chunk and #30 so you could see that the entire value of REALLY_LONG was displayed on the output. I did not override any font settings, but if you made the font smaller, you'd stuff more in the cell.

Cynthia

View solution in original post

5 REPLIES 5
ballardw
Super User

I'm not sure that RTF file allows splitting text in a single table cell across pages, so this may not be a Proc Report possibility easily.

 

When you say cuts off are you sure that it is Proc Report? If your variable has a length of 1375 does that need to be increased to hold text?

 

It never hurts to include the code, including ODS destination options, so we don't have to ask questions that the code would answer.

I made a small data set with a variable 1375 characters long and I don't get anything "cut off". The result I get is if the long variable doesn't fit on the current page it goes onto the next with the other variables.

 

If you can provide example data in the form of a data step that creates a set that your report can use that duplicates that behavior that helps a lot. If your data is two sensitive you can just make a long variable with nonsense like this:

data junk;
   input a $ b c;
   length varx $ 1375;
   varx= repeat(put(_n_,1.),1374);
datalines;
row1 123 456
row2 4   78910
row3 5678 12
row4 910  345
;

The long variable just has a digit repeated 1375 times.

 

mega
Fluorite | Level 6

I understand, but I don't believe this is a code or data issue. The long entries are not being cut off in the dataset and they are nowhere near SAS's length limit which is like 32k, the issue is that I don't have enough room to make that specific column in the report any wider so I'm wondering if it can continue on to the next page. For now I think I'll just make the font smaller for this variable and cross my fingers. 

ballardw
Super User

@mega wrote:

I understand, but I don't believe this is a code or data issue. The long entries are not being cut off in the dataset and they are nowhere near SAS's length limit which is like 32k, the issue is that I don't have enough room to make that specific column in the report any wider so I'm wondering if it can continue on to the next page. For now I think I'll just make the font smaller for this variable and cross my fingers. 


I will disagree and say that it is in part a Proc Report code issue. If you try to place 40 columns of report items on a page that only allows 45 columns of output (think typewriter at this point) then how you try to get the additional information displayed does relate.

Your description is lacking in many details, such as just how many other variables/columns that report is trying to produce, what approaches you have taken to reduce their width, how wide or long the logical page is allowed to be or even if this is ever actually printed on paper.

If making one column wider would solve your problem then PAPERSIZE could be the solution because you can set papersizes to ridiculous widths that won't print on most printers but will make logic widths such as for an online file quite large. Biggest I've tested is 24 by 36 inches but that was because I stopped at that size as it solved the resolution issue I was working with for multiple maps in a particular layout.

 

Cynthia_sas
SAS Super FREQ

Hi:

I tested with ODS RTF and ODS PDF, making a character variable of length $9000, with the actual length coming in at 8806 characters. Too much to fit on 1 page in RTF. I just used 1 obs from SASHELP.CLASS to dummy up some data. Basically my REALLY_LONG variable contains some lines from Jabberwocky that I repeated 30 times with a number in front of each repeat so I could make sure that the entire value was getting displayed in Word and Acrobat Reader. Here's the code I used:

Cynthia_sas_0-1674695172350.png

Notice that I put some line breaks in just to mimic some large text paragraphs. I used ODS ESCAPECHAR for the line breaks. Also part of making this work was using the NOTRKEEP option, which told Word, that a table row could split across pages. Without the option, it looked like the long text was just getting truncated. Also, I changed the orientation to landscape and made the margins .25 inch all around.

  I'm still not entirely clear on what you wanted to do with your page breaks, but this example shows that I got all 30 "chunks" of Jabberwocky into the column for the REALLY_LONG variable and the row could break across a page, as shown below:

Cynthia_sas_1-1674695357978.png

I highlighted the first chunk and #30 so you could see that the entire value of REALLY_LONG was displayed on the output. I did not override any font settings, but if you made the font smaller, you'd stuff more in the cell.

Cynthia

mega
Fluorite | Level 6

This is a screenshot of the problematic part of the report with identifying info blocked out. I left the last line of the first page to show how the text of the "Details" column runs off the bottom of the page and the footer is not present. I entered the type of data that would appear in the next row, and in reality these columns are about as wide as I can make them already. 

 

I don't know if anyone actually prints these out but I will check, because changing the papersize could definitely be the solution.

 

 

Screenshot 2023-01-31 121031.png

 

 

The PROC REPORT code looks like this: 

ods rtf author="mega" 
     file="&user.\Statistics\Safety Listings\AE_Listing_&extdt..rtf" startpage=no style=styles.printer;

proc report data=all
		split="|" missing nowindows headline headskip
		style(report)={just=center cellspacing=.001in width=100%}  
		style(lines)=header{background=white font_size=20pt font_face="TimesRoman" font_weight=bold just=left}
		style(header)=header{background=white font_face="TimesRoman" font_weight=bold just=center font_size=8pt}
		style(column)=header{background=white font_size=8pt font_face="TimesRoman" font_weight=medium};

column 
("AE Safety Listing" Subject_Number Occurence sdate EndDate AE_3 SAE Severity
		 Outcome Relationship Intervention AE_25);

define Subject_Number / display "Subj #" style(column)={protectspecialchars = off just=center width=0.3in};
define Occurence / display "AE #" style(column)={protectspecialchars = off just=center width=0.3in};
define sdate / display "AE Start Date | (Day of Treatment)" style(column)={protectspecialchars = off just=center width=0.75in};
define EndDate / display "Stop Date (Duration)" style(column)={protectspecialchars = off just=center width=0.85in};
define AE_3 / display "Site Reported AE Term" style(column)={protectspecialchars = off just=center width=1.3in};
define SAE / display "SAE" style(column)={protectspecialchars = off just=center width=.5in};
define Severity / display "Severity" style(column)={protectspecialchars = off just=center width=0.55in};
define Outcome / display "Outcome" style(column)={protectspecialchars = off just=center width=1in};
define Relationship / display "Relationship" style(column)={protectspecialchars = off just=center width=.9in};
define Intervention / display "Intervention" style(column)={protectspecialchars = off just=center width=.9in};
define AE_25 / display "Details" style(column)={protectspecialchars = off just=center width=2.15in};


*compute after / style=header{background=white font_size=8pt font_face="TimesRoman" font_weight=medium just=l};
*    line "";
*endcomp;


run;
quit;

ods rtf close;

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 1697 views
  • 1 like
  • 3 in conversation