BookmarkSubscribeRSS Feed
oussema
Obsidian | Level 7

Hello all,

I have this dataset named 'foreport' which will be used in proc report:

var1     var2     count      var4      var5    var6    var7    group  

one                                                                                  1

mn3     u1        15           5            5         4         1          1

mn3     u2        12           8            4        10        20        1 

mn3     u3          2           1            8         9         6           1

                                                                                        1

mn6     u1        11           2             5       10        8           1

mn6     u2         6            3            4         19       5           1

mn6     u3         5            6            2         6        3           1

two                                                                                 2                    

mn3     u1        15           5            5         4         1          2

mn3     u2         15           7            5         4         1          2

mn3     u3        15           5            5         4         1          2 

                                                                                       2

mn6     u1        15           5            5         4         1          2

mn6     u2        15           5            5         4         1          2

mn6     u3        15           5            5         4         1          2

three                                                                               3

mn3     u1        15           5            5         4         1          3

mn3     u2        15           5            5         4         1          3

mn3     u3        15           5            5         4         1          3

                                                                                       3

mn6     u1        15           5            5         4         1          3

mn6     u2        15           5            5         4         1          3

mn6     u3        15           5            5         4         1          3

 

What I want to get is table 'Want' displayed in the attached file  (PS: I need to remove blank line between '__________' and 'month 3').

 

 I tried with this program which need to be a bit modified to get the required result. It procudes the table 'Get' diplayed in the attached file

ods rtf file = "&path\file.rtf" STARTPAGE=no style=journal ;
ods escapechar='^'; 
proc report data = foreport  nowindows spacing = 1 headline headskip split = "|" ;
	columns  var1 var2 count var3 var4 var5 var6;
	by grp;
	define var1 /left group order=data "A" style(header)=[just=l font_weight=bold] style(column)=[just=l width=15%];
	define var2 /center display "B" style(header)=[just=c font_weight=bold] style(column)=[width=10%] ;
	define count /center display  "C" style(header)=[just=c font_weight=bold] style(column)=[width=8%] ;
	define var3 /center display  "D" style(header)=[just=c font_weight=bold] style(column)=[width=8%] ;
	define var4 /center display  "E" style(header)=[just=c font_weight=bold] style(column)=[width=18%] ;
	define var5 /center display  "F" style(header)=[just=c font_weight=bold]  style(column)=[width=18%];
	define var6 /center display  "G" style(header)=[just=c font_weight=bold] style(column)=[width=21%] ;
compute after var1 /
        style={protectspecialchars=off};
  line '\brdrt\brdrs ';
endcomp;
run; 
ods _all_ close;

 

Values inside the table are not important for me , I need just the layout.

I need to have a line under 'one' ,'two' and 'three' and not like in the table 'Get'.

I need to remove headers  reproduced because the by statement (I need only one header from the beginning).

Any suggestion please ? 

 

1 REPLY 1
MINX
Obsidian | Level 7

1. Create a new variable to differentiate 'one, two, three, four, etc.' from others. for example, if col1 in ('one'  'two' 'three' 'four') then cat=1; else cat=2;

2. Add new variable 'cat' into column statement before col1;

3. define cat /order order=data noprint;

4. compute after cat /

 

Good luck

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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