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?
That depends, what type of columns are you looking to supress?
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;
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.
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
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.
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.