I would use RWI to create a report with so many special layout requirements.
data have;
input strain $ day cyto $ age $;
datalines;
wuhan 1 CD107a 18
wuhan 1 IFN? 18
wuhan 1 TNFa 18
wuhan 1 L-12 18
wuhan 1 CD107a 40
wuhan 1 IFN? 40
wuhan 1 TNFa 40
wuhan 1 L-12 40
wuhan 64 CD107a 18
wuhan 64 IFN? 18
wuhan 64 TNFa 18
wuhan 64 L-12 18
wuhan 64 CD107a 40
wuhan 64 IFN? 40
wuhan 64 TNFa 40
wuhan 64 L-12 40
wuhan 120 CD107a 18
wuhan 120 IFN? 18
wuhan 120 TNFa 18
wuhan 120 L-12 18
wuhan 120 CD107a 40
wuhan 120 IFN? 40
wuhan 120 TNFa 40
wuhan 120 L-12 40
wuhan 360 CD107a 18
wuhan 360 IFN? 18
wuhan 360 TNFa 18
wuhan 360 L-12 18
wuhan 360 CD107a 40
wuhan 360 IFN? 40
wuhan 360 TNFa 40
wuhan 360 L-12 40
;
run;
data want;
set have;
if age= "18" then agegrp = "18-39";
else if age = "40" then agegrp = "40-60";
drop age;
run;
proc sort data=want out=want1;by strain day agegrp; run;
data want2;
set want1;
by strain day agegrp;
retain agegrpcat .;
if first.agegrp then agegrpcat+1;
run;
data want3;
set want2(rename=(day=_day));
by strain _day agegrp agegrpcat;
output;
if last.agegrpcat then do;
ARRAY chars _CHARACTER_;
do over chars;
if strip(upcase(vname(chars))) not in ('STRAIN' 'AGEGRPCAT' '_DAY') then do;
call missing(chars);
end;
end;
ARRAY nums _NUMERIC_;
do over nums;
if strip(upcase(vname(nums))) not in ('STRAIN' 'AGEGRPCAT' '_DAY') then do;
call missing(nums);
end;
end;
day=_day;
output;
end;
drop _day;
run;
ods pdf file="C:\Users\Classroom\Desktop\internship\practice.pdf";
proc report data=want3 spanrows headskip nowd headline ps=170 split='*' missing contents="";
column strain day agegrp agegrpcat Cyto;
define strain / style={just=c asis=on cellwidth=6% vjust=center} order flow;
define day / style={just=c asis=on cellwidth=7% vjust=center} "Day" flow;
define agegrp / style={just=c asis=on cellwidth=9% vjust=center} "Age Group" flow;
define agegrpcat / noprint ;
define Cyto / style={just=c asis=on cellwidth=7%} "Cytokine" display flow;
run;
ods pdf close;
- Cheers -
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.