The SAS Output Delivery System and reporting techniques

Remove some columns from ODS RTF output

Reply
Occasional Contributor
Posts: 9

Remove some columns from ODS RTF output

Hello

I have generated some demographic tables using PROC TABULATE and I want ODS RTF output only. But in that RTF output I want to delete  or hide some unnecessary columns.

Please suggest some ways How I can do that?

Super User
Posts: 17,828

Re: Remove some columns from ODS RTF output

That depends, what type of columns are you looking to supress?

SAS Super FREQ
Posts: 8,743

Re: Remove some columns from ODS RTF output


Hi: PROC TABULATE doesn't necessarily "hide" unwanted columns or headers unless they are the name of a statistic or the name of a variable. For example, the code below produced both of the screen shots. If you need more specific help, you will have to post the code that you've tried and some sample data. Or, replicate your question using SASHELP datasets and include ALL your code, so people can see what you're currently getting and then the explanation of deleting or hiding some extra columns will make sense because we will all be able to see what you are currently producing.

Cynthia

ods rtf file='c:\temp\tabexamp.rtf';

proc tabulate data=sashelp.class;
  class age sex;
  var height weight;
  table sex*mean,
        age*(height weight);
run;
     
proc tabulate data=sashelp.class;
  class age sex;
  var height weight;
  table sex=' '*mean=' ',
        age=' '*(height=' ' weight=' ')
    /row=float box='Headers Suppressed';
run;
ods _all_ close;


TABULATE_headers_gone.pngTABULATE_suppress_headers.png
Occasional Contributor
Posts: 9

Re: Remove some columns from ODS RTF output

Please find the attached  RTF output. In that I want to delete all the columns labeled as 'no'.

The code is described below:-

proc tabulate data=mylib.sample missing noseps style=[just=center] style=[font_size=1] style=[font_face=arial];

where q502=1;

format q105 q105a.  htype htypefmt. q51s q51s. q52s q52s. q53s q53s. q54s q54s. ;

class q105 htype q51s q52s q53s q54s/ style=[just=center] style=[font_weight=bold] preloadfmt order=data;

classlev q105 htype q51s q52s q53s q54s/ style=[just=left];

table q105 htype,  N='Total'*f=best8.0 rowpctn='Item'*(q51s='' q52s='' q53s='' q54s='')*f=comma8.1' / rts=25 row=float condense nocontinued style=[just=center] misstext='0.0';

run;

Please let me know if anything else is required.


query.png
SAS Super FREQ
Posts: 8,743

Re: Remove some columns from ODS RTF output

Hi:

  If you have values of NO in the data for your crossing, then if you eliminate the NO observations, your percents will come out wrong. Are you saying that the you want to calculate the percent for 1, 2 ,3, 4 values, but NOT for the NO values? You are naming ROWPCTN statistic with a label of Item. Then you nest 4 class variables under the ROWPCTN statistic. So, if you truly want the ROWPCTN, do you want the NO observations included or excluded from the calculation of the row percent and/or do you want the ROWPCTN for the NO observations to be calculated, but not shown in the table?

  You might have to make 2 passes through the data to do what you want. I am really not in a position to make up some test data and although you showed your code, you did not show ALL your statements and you did not provide any data for anyone to test with. If you are doing a survey, you might look at some of the examples in the TABULATE documentation about dealing with multiple choice survey data...here's one example from the doc: Base SAS(R) 9.4 Procedures Guide, Third Edition .

cynthia

Ask a Question
Discussion stats
  • 4 replies
  • 603 views
  • 0 likes
  • 3 in conversation