BookmarkSubscribeRSS Feed
scify
Obsidian | Level 7

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:

report issue.png

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?

1 REPLY 1
ed_sas_member
Meteorite | Level 14

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 720 views
  • 0 likes
  • 2 in conversation