Help using Base SAS procedures

Proc Tabulate Question

Reply
N/A
Posts: 0

Proc Tabulate Question

Dear All,

I had difficulty creating a 2-D table using proc tabulate:

________________I_______________II_____________________ALL____

ALL____________N_______________N____________________N_______

COMP(b)_______N_(COLPCTN)____N_(COLPCTN)_____N_(COLPCTN)___

DSC
1___________N_(COLPCTN)_____N_(COLPCTN)_____N_(COLPCTN)___
2___________N_(COLPCTN)_____N_(COLPCTN)_____N_(COLPCTN)___
....
6___________N_(COLPCTN)_____N_(COLPCTN)_____N_(COLPCTN)___

Say 'comp' is a class, it has two categories 'a' and 'b'. Under category 'a' there is another class called 'dsc' which has 6 categories. The table will include summary(N, COLPCTN) for category 'b' in 'comp' in one row, and it also include summary for each subgroup in 'dsc' but not the summary for 'a' in 'comp' in following rows. How to do the table operation to achieve this? And is there any way to put N and COLPCTN in the same cell with a parenthesis around COLPCTN?

Thanks.
PROC Star
Posts: 1,760

Re: Proc Tabulate Question

Posted in reply to deleted_user
Something like this?
[pre]data MIMIC;
set SASHELP.PRDSALE(where=(PRODUCT ne 'SOFA'));
proc format;
value $prodtyp (default=12) 'BED' =' FURNITURE';
proc tabulate order=formated;
class PRODUCT COUNTRY;
table all PRODUCT='', COUNTRY*(n colpctn)*f=comma8.0;
format PRODUCT $prodtyp.;
run;
[/pre]
Only one stat per cell in the tabulate procedure.
Since you only want only one left-hand class column, you must choose between displaying 2 variables in a row
[pre]table all PRODTYPE='' PRODUCT=''[/pre]which requires massaging the data before hand,
or displaying one variable and masking it by using a format, which I did.
Ask a Question
Discussion stats
  • 1 reply
  • 98 views
  • 0 likes
  • 2 in conversation