BookmarkSubscribeRSS Feed
TamannaGarg
Calcite | Level 5

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?

4 REPLIES 4
Reeza
Super User

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

Cynthia_sas
SAS Super FREQ


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
TamannaGarg
Calcite | Level 5

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
Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 4 replies
  • 1212 views
  • 0 likes
  • 3 in conversation