- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is your destination of interest? RTF, PDF, HTML, Excel? Normally, you would use a ESCAPECHAR and {newline} to insert a line break. but it depends on the destination, which you don't show. You only show creating the variable, you don't show how you're displaying the variable -- ODS RTF? ODS PDF??? What procedure? PRINT, REPORT???
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Cynthia,
I am using Proc Report, I have pasted some of the code I've been using!
Thank you for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There were some special line breaking and line wrapping ESCAPECHAR commands in the original version of ODS ESCAPECHAR (V8.2). However, when ESCAPECHAR was revamped for SAS 9 I believe the special ones were deprecated and may not work in any destinations.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;