Dear,
with my code I am getting the following output . But I need to have an underline after first row of values(shown below). Please help in my code. Thanks
Code;
ods escapechar="^";
ods listing close;
ods rtf file="C:\Users\\\ae_1.rtf" style=journal;
proc report data=all2;
column grpm grps grpws aetext ("^R'\brdrb\brdrs\brdrw15 'Phase1" v1 v2) ("^R'\brdrb\brdrs\brdrw15 'Phase2" v5 v6);
define grpm/order noprint;
define grps/order noprint;
define grpws/order noprint;
define aetext/ display '' ;
define v1/ "75 mg" ;
define v2/ "150 mg" ;
define v5 / "75 mg" ;
define v6/ "150 mg" ;
run;
ods rtf close;
Output getting
_________________________________________________
P1 P2
________ ___________
v1 v2 v5 v6
______________________________________________________
nsubjects n=2 n=3 n=4 n=5
disorders 10 (50) 11(20) 20 (30) 21(30)
____________________________________________________________
Output needed;
_________________________________________________
P1 P2
__________ ___________
v1 v2 v5 v6
nsubjects n=2 n=3 n=4 n=5
_________________________________________________________
disorders 10 (50) 11(20) 20 (30) 21(30)
____________________________________________________________
Usually you don't have the Nsubjects line, it's simply var1 (n=20) with N on a separate line.
Look at BREAK statement and/or review clinical trial reporting papers on lexjansen.com
You need put n=3 into the label of variables: define aetext/ display 'nsubjects' ; define v1/ "v1 ^n n=2"; define v2/ "v2 ^n n=3" ; OR proc report data=.... split='/' ; ...... define v1/ "v1 / n=2 ";
Thanks for your reply. My data set looks like this. The variables are (aetext v1 v2 v5 v6). Does youR code for this to get the output i need.
data
aetext v1 v2 v5 v6
NS N=2 N=5 N=5 N=7
DISORDER 10 (50) 11(20) 20 (30) 21(30)
Output need;
_________________________________________________
P1 P2
__________ ___________
v1 v2 v5 v6
NS n=2 n=5 n=5 n=7
_________________________________________________________
DISORDER 10 (50) 11(20) 20 (30) 21(30)
____________________________________________________________
No. You shouldn't put 'NS' as an obs ,should make it as variable's labels. delete that 'NS' obs and turn it into variable's labels. proc report .......... split='*'; define aetext/'NS' ; define v1/ 'v1*N=2' ; .........
Thanks for the help. It worked. I am attaching the sample output. Why my column names are not alligning with column values. Also the underline beneath titration phase and stable phase should be 2 separate lines as per the code. why it is a continous line. Please help. Thank you.
code
proc report data=one3 center headskip nowd missing split='|'
style(report)={outputwidth=90% cellpadding=3 frame=above}
style(header)={font_weight=bold fontsize=9pt fontstyle=ROMAN}
style(lines)={cellpadding=1 fontsize=3pt};
column grpm grps grpws aetext ("^R'\brdrb\brdrs\brdrw10 'Titration Phase" cnt_pct1 cnt_pct2 cnt_pct3 cnt_pct4) ("^R'\brdrb\brdrs\brdrw10 'Stable Dose Phase" cnt_pct5 cnt_pct6 cnt_pct7 cnt_pct8);
define grpm/order noprint;
define grps/order noprint;
define grpws/order noprint;
define aetext/ "System Organ Class|Preferred Term, n (%)" style(column)={asis=on cellspacing=.25pt just=left} ;
define cnt_pct1/ "00 mg|N=19" style(column)={cellspacing=.25pt just=left} ;
define cnt_pct2/ "000 mg|N=26" style(column)={cellspacing=.25pt just=left} ;
define cnt_pct3/ "000 mg|N=35" style(column)={cellspacing=.25pt just=left} ;
define cnt_pct4/"-000|N=80" style(column)={cellspacing=.25pt just=left};
define cnt_pct5 / "00 mg|N=12" style(column)={cellspacing=.25pt just=left} ;
define cnt_pct6/ "000 mg|N=19" style(column)={cellspacing=.25pt just=left};
define cnt_pct7/ "000 mg|N=31" style(column)={cellspacing=.25pt just=left};
define cnt_pct8/"_110|N=62" style(column)={cellspacing=.25pt just=left} ;
run;
For your first question, make sure JUST= has the same value in HEADER and COLUMN. For your second question, make a dummy variable xx to make a gap. proc report data=one3 center headskip nowd missing split='|' style(report)={outputwidth=90% cellpadding=3 frame=above} style(header)={font_weight=bold fontsize=9pt fontstyle=ROMAN just=left } <---------------- style(lines)={cellpadding=1 fontsize=3pt}; column grpm grps grpws aetext ("^R'\brdrb\brdrs\brdrw10 'Titration Phase" cnt_pct1 cnt_pct2 cnt_pct3 cnt_pct4) xx <--------------- ("^R'\brdrb\brdrs\brdrw10 'Stable Dose Phase" cnt_pct5 cnt_pct6 cnt_pct7 cnt_pct8); define grpm/order noprint; define grps/order noprint; define grpws/order noprint; define aetext/ "System Organ Class|Preferred Term, n (%)" style(column)={asis=on cellspacing=.25pt just=left} ; define cnt_pct1/ "00 mg|N=19" style(column)={cellspacing=.25pt just=left} ; <-------------- define cnt_pct2/ "000 mg|N=26" style(column)={cellspacing=.25pt just=left} ; define cnt_pct3/ "000 mg|N=35" style(column)={cellspacing=.25pt just=left} ; define cnt_pct4/"-000|N=80" style(column)={cellspacing=.25pt just=left}; defeine xx/" " computed; <------------- define cnt_pct5 / "00 mg|N=12" style(column)={cellspacing=.25pt just=left} ; define cnt_pct6/ "000 mg|N=19" style(column)={cellspacing=.25pt just=left}; define cnt_pct7/ "000 mg|N=31" style(column)={cellspacing=.25pt just=left}; define cnt_pct8/"_110|N=62" style(column)={cellspacing=.25pt just=left} ; compute xx /length=2; <---------------------- xx=" " ; endcomp; run;
compute xx /length=2 CHARACTER ; <---------------------- xx=" " ; endcomp;
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.
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.