BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Hi I need help in my code

 

I am running proc print with label option in it. I am using following codes.

 

 

data seven;
set six;
label  aetext='Treatment-emergent
                       Adverse Event';
run;
 
proc print data=seven label;
var aetext cnt_pct1 cnt_pct2 cnt_pct3 cnt_pct4 cnt_pct5 cnt_pct6 cnt_pct7;
run;

 

  I need output for aetext label statement 

       Treatment-emergent

        Adverse Event.

 

But my output shows like this.

 

Treatment-emergent                                                         Adverse Event

 

Thanks

4 REPLIES 4
Reeza
Super User

Please see  Splitting Labels across Two or More Lines in the following link:

http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001292467.htm

 

Use the SPLIT option within proc print.

 

options linesize=80 pageno=1 nodate;

proc sort data=qtr02;
   by SalesRep; 
run;

proc print data=qtr02 noobs split='/';
   var SalesRep Month Units AmountSold;
   where Month='04';
   format Units comma7. AmountSold dollar14.2;
   sum Units AmountSold;
   title 'TruBlend Coffee Maker Sales Report for April';
   label SalesRep   = 'Sales/Representative'
         Units      = 'Units/Sold'
         AmountSold = 'Amount/Sold';
   run; 
Astounding
PROC Star

Instead of adding all those blanks in the middle of the label, add a character instead:

 

label aetext = 'Treatment-emergent*Adverse Event';

 

Then change the PROC PRINT statement to indicate that an asterisk within a label is actually an instruction to start a new line:

 

proc print data=seven split='*';

 

Using SPLIT= implies that labels are in effect, so you don't need to add the LABEL option.

 

 

Looks like Reeza is a little faster than me. Smiley Wink

 

 

knveraraju91
Barite | Level 11

Thank you all for your support

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Great advice from @Reeza@Astounding.  I would add that you may want to move to proc report.  You are generating clinical tables there, you will find that the control you have with proc report helps later on.  Another few things to remember, its likely you are going to RTF destination, you may want to put RTF tags in and control output that way also.  You can do this by using an Escape character:

ods escapechar="^";

You can do all kinds of funky things with the output then, have a look at this for example:

http://www2.sas.com/proceedings/forum2007/099-2007.pdf

 

One other thing to remember, whilst it doesn't impact on the titles, if you were to use the technique of indenting by using spaces in the data, i.e.

COL1

HEADACHE^{newline}     HEAD

This would come out without the spaces.  You need to use the option:

define COL1 / "Title" style{column}={asis=on};

Note the asis=on, this is always a headache if you don't know what to look for,

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5145 views
  • 5 likes
  • 4 in conversation