Hi, I have this line of code below that is spitting out a column 4 with a p-value, risk difference, and confidence interval. I want to find a way to create a line break after the p-value so that the output looks like this:
0.005 (p-value)
0.125 [0.25,1.50] (risk diff, CI)
data freq3;
length rowlabel $100 col_1 col_2 col_3 col_4 $32 ;
set freq1;
*rowlabel=' Risk Difference (95% CI)^{super 3}';
col_4=strip(put(p_pchi, 8.3))||strip(put(_rdif2_, 8.3))||' ['||strip(put(xl_rdif2, 8.3))||', '||strip(put(xu_rdif2, 8.3))||']';
col_1=''; col_2=''; col_3='';
roworder=2;
run;
Any help is much appreciated! Thank you!
@kmardinian wrote:
Hi, I have this line of code below that is spitting out a column 4 with a p-value, risk difference, and confidence interval. I want to find a way to create a line break after the p-value so that the output looks like this:
0.005 (p-value)
0.125 [0.25,1.50] (risk diff, CI)
data freq3;
length rowlabel $100 col_1 col_2 col_3 col_4 $32 ;
set freq1;
*rowlabel=' Risk Difference (95% CI)^{super 3}';
col_4=strip(put(p_pchi, 8.3))||strip(put(_rdif2_, 8.3))||' ['||strip(put(xl_rdif2, 8.3))||', '||strip(put(xu_rdif2, 8.3))||']';
col_1=''; col_2=''; col_3='';
roworder=2;
run;
Any help is much appreciated! Thank you!
I would make another observation for the second row. Splitting within the cell can be done with the split character assuming something like PROC REPORT but you will need to supply more info.
Hi Cynthia,
I am using Proc Report, I have pasted some of the code I've been using!
Thank you for your help!
Hi, Cynthia:
I recalled there were some special line break commands associated with escapechar, such as ~m (to specify the break location of a string) and ~-2n(to force a line wrapping corresponding to ~m location). Are those commands still supported by SAS 9.4?
e,g.
....
computer after;
line "abbreviation: ~mN = Total subjects treated with the study drug ... ~-2nM= subjects who discontinued treatment..." ;
endcomp;
Thanks, Cynthia!
However, if I want to reserve some monocharacters, say 7 char spaces in the next row indentation, adding ~_~_~_~_~_~_~_ of using pretext = '\pnhang\fi-222\li222 ' (hard to locate exact position) is not convenient. Is there any better way to achieve the same results?
Best Regards
Don
example: a footnote as followings in a rtf table:
Abbreviation: N = ............, n = .............., m = ...........;
R = ......; T = .......; (indentation aligned up with the first-row text)
Ok, making another option was going to be my second option. I assumed I could split in the data step. If I create a new observation where they are both in column 4 so that it was like this:
data freq2;
length col_4 $32;
set freq1;
col_4=strip(put(p_pchi, 8.3));
roworder=2;
outcome=1;
run;
data freq3;
length rowlabel $100 col_1 col_2 col_3 col_4 $32 ;
set freq1;
*rowlabel=' Risk Difference (95% CI)^{super 3}';
col_4=strip(put(_rdif2_, 8.3))||' ['||strip(put(xl_rdif2, 8.3))||', '||strip(put(xu_rdif2, 8.3))||']';
col_1=''; col_2=''; col_3='';
roworder=2;
run;
But then how would I split it in the proc report statement?
proc report nowd center spanrows missing data=all split='*' list out=test
style(report)=[width=100% frame=void rules=none cellspacing=0 padding=1pt font=('Courier New', 8pt)]
style(header)=[bordertopcolor=balck bordertopwidth=1
borderbottomcolor=black borderbottomwidth=1
background=white font=('Courier New', 8pt) textalign=c ]
style(column)=[font=('Courier New', 8pt) ASIS=ON ] ;
columns roworder rowlabel ("X*(N=&N1.)" col1) ("Y*(N=&N2)" col2) ("Total*(N=&N3)" col3) ('p-value^{super 1}*Risk Difference^{unicode delta_u}(95% CI)' col_4);
*define _PB_page/group noprint;
* define vorder/order noprint;
define roworder/order noprint;
define rowlabel/display '' style(column)=[width=1.5in] flow;
define col1/display '' style(column)=[width=0.8in] center flow;
define col2/display '' style(column)=[width=0.8in] center flow;
define col3/display '' style(column)=[width=0.8in] center flow;
define col_4/display ' ' style(column)=[width=1.2in] center flow;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.