BookmarkSubscribeRSS Feed
Niugg2010
Obsidian | Level 7

I want to get the below output. However, when I run my below code I can not get the red marked part.

Is there anyone help me out?

Thanks a lot.

 

 

2.jpg

 

data x;
	do var1='A', 'B', 'C'; 	output;  end;

	do var1='A', 'B', 'C';
		do var2="aa",'bb', 'cc';
			output;
		end;
	end;

	do var1='A', 'B', 'C';
		do var2="aa",'bb', 'cc';
			do var3=1 to 20;
				output;
			end;
		end;
	end;
run;

data x;
	set x;
	length var4 $10;
	if missing(var2) then do; level=1; var4=var1; end;
		else if missing(var3) then do; level=2; var4=var2; end;
		else do; level=3; var4=strip(var3); end;
run;

proc sort data=x; by var1 var2 var3; run;
data x;
	set x;
	_page=ceil(_n_/25);
	keep _page level var4;
run;

ods rtf file="...\try.rtf";
proc report data=x;
column  _page level var4;
	define _page/ group noprint;
	define level/ display order=data noprint;
	define var4/display order=data;
	break after _page/page;
	compute var4;
		if level=2 then call define(_col_, "style", "style=[indent=0.5 in]");
		if level=3 then call define(_col_, "style", "style=[indent=1 in]");
	endcomp;
run;
ods rtf close;
2 REPLIES 2
Niugg2010
Obsidian | Level 7

Thanks for your suggestion. Still I did not figure out how to get what I want.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 675 views
  • 0 likes
  • 2 in conversation