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

I am trying to print the address as a main group header of my report from data and want the lines to wrap up properly.

 

I have different fields for address in data that i have concatenated to get 1 field

for example:

name, address1, address2,city,state,zip ----->cats(name,address1,city,state,zip) as new_add in my table

eg: one of new_place data value is ---> Mcdonald's,100 newyork Ave,Queens,NY,56432

 

reports prints it out as 1 line on bygroup header  : Mcdonald's,100 newyork Ave,Queens,NY,56432 (i am using byvar(new_add) on title to print on different pages)

 

But i want to be broken and text wrraped as below :

Mcdonald's

100 newyork Ave 

Queens NY 56432

 

what options in proc report can be used to do so.

 

here's my code

TITLE1 bold f= Calibri h=14pt wrap j=c "reportTitle";
TITLE4      " ";
TITLE5    f= Calibri j=l h=9pt    "#byval(new_add)";

proc report nofs  data = rep nowd spanrows split='~' headline missing

by new_add  ;
column new_add  var1 var2 var3;

;
define  new_add /group noprint '' format=$place. left style = {cellwidth=70mm  rules=none };

define var1/group   left style = {cellwidth=70mm  rules=none };

define var2/group   left style = {cellwidth=70mm  rules=none };

define var3/group   left style = {cellwidth=70mm  rules=none };

run;

break after  new_add / skip dul;
run;

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Here's a full example with the output shown in RTF and PDF.

cynthia

use_escapechar.png

View solution in original post

4 REPLIES 4
ballardw
Super User

I would suggest that when you concatenate the fields together to make your new_add variable to insert either a carriage return, linefeed or newline character to force breaks. Which to use may depend on ODS destination.

Ksharp
Super User

How about this:


data class;
 set sashelp.class;
 group=catx('~n',sex,age);
run;
proc sort data=class ;by group;run;
options nobyline;
ods escapechar='~';
title '#byval1';
proc report data=class nowd;
by group;
column Name	Sex	Age	Height	Weight	;
run;

Cynthia_sas
SAS Super FREQ

Hi:

  Here's a full example with the output shown in RTF and PDF.

cynthia

use_escapechar.png

Arora_S
Obsidian | Level 7

This works too..but the later one is more explanatory.

Thanks to everybody.

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
  • 4 replies
  • 1038 views
  • 2 likes
  • 4 in conversation