I'm trying to add a column with a manual title to an already existing proc report. However, when I add the code to the column line, the resulting report puts all of the new data in the title rows rather than the table, then fills the table cells in with 1. Here's my code:
data test;
input col1 $ col2 $ col3 $ col4 $ col5 $ @@ ;
datalines;
foo bar foo bar foo
bar foo bar foo foo
foo bar foo bar foo
;
proc report data=test spanrows nowd
style(header)={bordertopwidth=.5 borderbottomwidth=.5
borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
bordercolor=black};
column ('Overall' (("Group 1" (col1 col2)) ("Group 2" (col3 col4)) ("Group 3" (col5)) ));
define col1 / " " style(column)={width=100%};
define col2 / " " style(column)={width=100%};
define col3 / " " style(column)={width=100%};
define col4 / " " style(column)={width=100%};
define col5 / " " across style(column)={width=100% vjust=m just=c tagattr='wrap:yes'};
run;
The result I'm getting is this:
What I'm looking for is Group 3 to be on the same row as Group 1 and Group 2, and 'foo' to be in the cells where the 1s are. As far as I can tell, my column statement is nested properly, and messing with the the final group doesn't seem to change anything. What am I missing?
Hi @scify
Have you tried to remove the "across" option in the DEFINE col5 statement ?
data test;
input col1 $ col2 $ col3 $ col4 $ col5 $ @@ ;
datalines;
foo bar foo bar foo
bar foo bar foo foo
foo bar foo bar foo
;
proc print
;
run;
proc report data=test spanrows nowd
style(header)={bordertopwidth=.5 borderbottomwidth=.5
borderleftwidth=.5 borderrightwidth=.5 borderstyle=solid
bordercolor=black};
column ('Overall' (("Group 1" (col1 col2)) ("Group 2" (col3 col4)) ("Group 3" (col5)) ));
define col1 / " " style(column)={width=100%};
define col2 / " " style(column)={width=100%};
define col3 / " " style(column)={width=100%};
define col4 / " " style(column)={width=100%};
define col5 / " " style(column)={width=100% vjust=m just=c tagattr='wrap:yes'};
run;
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.