Help using Base SAS procedures

Table editing for documentation

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Table editing for documentation

I have a dataset:

RBCDEF
Boarding340.32352911-3612%
Buyer170.05882413916%
Living w400.1%
Other50.21222%
Owner700.142857108425%
Renting1500.2842-2253%
Supplied111-1000%

What sas code would you write to turn this into a nice table for documentation? - I currently have a SAS tabulate but just cant get what I want.

- Could I have some tips for editing tables? labeling of the variables, titles, font centering, size, borders etc.

Thanks


Accepted Solutions
Solution
‎08-22-2011 10:59 PM
Super User
Posts: 10,020

Table editing for documentation

Posted in reply to willy0625

Add it into ArtC's code.

But I recommend you to post it into ODS and report Forum. There is a SAS man named Cynthia who is very good at this.

And If you need more control about report ,I think Cynthia will help you a lot.

data types;
input curr_resiStatus $ count bad Total_Bad Index participants :percent.;
format participants percent.;
datalines;
Boarding 34 0.323529 11 -36 12%
Buyer 17 0.058824 1 391 6%
Livingw 4 0 0 . 1%
Other 5 0.2 1 22 2%
Owner 70 0.142857 10 84 25%
Renting 150 0.28 42 -22 53%
Supplied 1 1 1 -100 0%
run;

title1 'This is a title';
ODS RTF BODY='tables.rtf' style=Journal ;
proc report data=types nowd out=test;
   columns ('Spanning Text' curr_resiStatus count bad Total_Bad Index participants) ;
   define count/style={cellwidth=4cm};
   compute curr_resiStatus;
   if _BREAK_='_RBREAK_' then curr_resiStatus='Total';
   endcomp;
   rbreak after / summarize;
   run;
ODS RTF CLOSE;

Ksharp

View solution in original post


All Replies
Valued Guide
Posts: 634

Table editing for documentation

Posted in reply to willy0625

Without knowing what you want your table to look like it is very hard to guess what to show to you.  Here is some code that changes variable names, variable labels, titles, and text.  Since there is no data to summarize, TABULATE seems a less likely choice.

data types;
input Type $ B C D E F Smiley Tongueercent.;
label b = 'count';
datalines;
Boarding 34 0.323529 11 -36 12%
Buyer 17 0.058824 1 391 6%
Livingw 4 0 0 . 1%
Other 5 0.2 1 22 2%
Owner 70 0.142857 10 84 25%
Renting 150 0.28 42 -22 53%
Supplied 1 1 1 -100 0%
run;

title1 'My Special Data';
proc print data=types;
   run;
proc report data=types nowd;
   columns Type B C D E F;
   define c / display 'R O I';
   run;

Contributor
Posts: 27

Re: Table editing for documentation

ODS RTF BODY='tables.htm' style=Journal;

proc print data=data NOOBS;

run;

ODS RTF CLOSE;

produces

curr_resiStatus

count

bad

total_bad

Index

participants

Boarding

34

0.32353

11

-36

12%

Buyer

17

0.05882

1

391

6%

Living w

4

0.00000

0

.

1%

Other

5

0.20000

1

22

2%

Owner

70

0.14286

10

84

25%

Renting

150

0.28000

42

-22

53%

Supplied

1

1.00000

1

-100

0%

which is what I want, except, I would like to add a bar at the bottom of the table for the total figures and also I would like to perform

hsplit so that the upper part of the table looks like

curr_resiStatus

Count

Bad

Total_bad

Index

participants

Valued Guide
Posts: 634

Re: Table editing for documentation

Posted in reply to willy0625

Much clearer. I am still not quite sure what we are doing with the first column, but the following makes sense to me as a next step closer.  I added a title and some spanning text in a REPORT step.  I also changed the ODS file extension to RTF.

data types;
input curr_resiStatus $ count bad Total_Bad Index participants Smiley Tongueercent.;
format participants percent.;
datalines;
Boarding 34 0.323529 11 -36 12%
Buyer 17 0.058824 1 391 6%
Livingw 4 0 0 . 1%
Other 5 0.2 1 22 2%
Owner 70 0.142857 10 84 25%
Renting 150 0.28 42 -22 53%
Supplied 1 1 1 -100 0%
run;

title1 'This is a title';
ODS RTF BODY='tables.rtf' style=Journal;
proc report data=types nowd;
   columns ('Spanning Text' curr_resiStatus count bad Total_Bad Index participants) ;
   rbreak after / summarize;
   run;
ODS RTF CLOSE;

Contributor
Posts: 27

Table editing for documentation

Just a couple of more things: How do you add another horizontal bar between the last line and the second to the last line so that I have a nice last row that looks like

-----------------------------------

total        3582     1016   . . . .

-----------------------------------

I am also trying to manipulating the space between the columns, How would you do this?

Many thanks

Solution
‎08-22-2011 10:59 PM
Super User
Posts: 10,020

Table editing for documentation

Posted in reply to willy0625

Add it into ArtC's code.

But I recommend you to post it into ODS and report Forum. There is a SAS man named Cynthia who is very good at this.

And If you need more control about report ,I think Cynthia will help you a lot.

data types;
input curr_resiStatus $ count bad Total_Bad Index participants :percent.;
format participants percent.;
datalines;
Boarding 34 0.323529 11 -36 12%
Buyer 17 0.058824 1 391 6%
Livingw 4 0 0 . 1%
Other 5 0.2 1 22 2%
Owner 70 0.142857 10 84 25%
Renting 150 0.28 42 -22 53%
Supplied 1 1 1 -100 0%
run;

title1 'This is a title';
ODS RTF BODY='tables.rtf' style=Journal ;
proc report data=types nowd out=test;
   columns ('Spanning Text' curr_resiStatus count bad Total_Bad Index participants) ;
   define count/style={cellwidth=4cm};
   compute curr_resiStatus;
   if _BREAK_='_RBREAK_' then curr_resiStatus='Total';
   endcomp;
   rbreak after / summarize;
   run;
ODS RTF CLOSE;

Ksharp

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 165 views
  • 6 likes
  • 3 in conversation