The is a proc report with a #BYVAL statement header:
ods listing close;
ods &outype file="%sysfunc(pathname(out))\&outname2..&outype" style=acrsstyle &bookmk;
run;
proc report data=tab split='~' missing nowd style={bordertopcolor=black bordertopwidth=1};
column pgcnt COHORT SITEID SUBJECT DATE AGE_C SEX RACE_C ETHNIC WGTLB_C HGTINCH_C CBP FST PROT ;
define pgcnt / order order=internal noprint;
define COHORT / order order=data noprint;
define SITEID / order order=internal 'Site' style(column)=[width=10% just=left asis=on font_face=&fontf font_size=&fontsz ] ;
define SUBJECT / order order=internal 'Subject' style(column)=[width=11% just=left asis=on font_face=&fontf font_size=&fontsz ] ;
define DATE / 'Date of Birth' style(column)=[width=7% just=left asis=on font_face=&fontf font_size=&fontsz ] ;
define AGE_C / 'Age~(Years)' style(column)=[width=5% just=left asis=on font_face=&fontf font_size=&fontsz ] ;
define SEX / 'Gender' style(column)=[width=5% just=left asis=on font_face=&fontf font_size=&fontsz ] ;
define RACE_C / 'Race' style(column)=[cellwidth=8% just=left asis=on font_face=&fontf font_size=&fontsz ] flow ;
define ETHNIC / 'Ethnicity' style(column)={width=7.5% just=left font_face=&fontf font_size=&fontsz};
define WGTLB_C / 'Weight~(kg)' style(column)={width=6% just=left font_face=&fontf font_size=&fontsz};
define HGTINCH_C / 'Height~(cm)' style(column)={width=6% just=left font_face=&fontf font_size=&fontsz};
define CBP / "Childbearing~Potential?" style(column)={width=9% just=left font_face=&fontf font_size=&fontsz};
define FST / "FST~Score" style(column)={width=8% just=left font_face=&fontf font_size=&fontsz};
define PROT / "Protocol~Version" style(column)={width=15% just=left font_face=&fontf font_size=&fontsz};
break after pgcnt / page;
compute before SUBJECT ;
line '' ;
endcomp;
by COHORT;
TITLE8 justify=left 'Treatment: #BYVAL(COHORT)';
endcomp;
run;
ods &outype close;
ods listing;
The space between headline and "Treatment: #byvar" header should be removed, I've tried few things but it doesn't work:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.