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
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;
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.
Thank you all for your support
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.