Help using Base SAS procedures

merged first cell in proc tabulate

Reply
Super Contributor
Posts: 395

merged first cell in proc tabulate

Hi, I thought I'd change the discussion a little... when I run this code I get "merged" cells in the first row.. how can I get rid of the merged feature.  Se diagram below of what I get, and my proc tabulate code:

Picture3.jpg

This is the code I use from a Proc Tabulate:

TABLE Transaction_Type*CI1_T,N pctn<CI1_T all> /rts=35;

Thanks

SAS Super FREQ
Posts: 8,743

Re: merged first cell in proc tabulate

Hi:

  That "merged cell" is a side effect of how TABULATE operates. The big empty "box" at the intersection of your row headers (TRANSACTION_TYPE and CI1_T) and your column headers (N and PCTN) causes the row headers to be placed in the first "row", thus causing what you show. Here's an interesting blog post about how this is one reason why folks switch over to PROC REPORT.

http://blogs.sas.com/content/sasdummy/2010/10/22/proc-report-versus-tabulate-two-sas-heavyweights/

  With only 1 variable in the ROW dimension, you can put a variable value into the big empty box. Or, you can put a string of your own choosing up in the BOX area. In either of those cases, you can suppress the header for TRANSACTION_TYPE and CI1_T and it would make the whole row go away. (I took out the RTS= option because your output looks like PDF and PDF essentially ignores the RTS option.

  

cynthia

TABLE Transaction_Type=' '*CI1_T=' ',N pctn<CI1_T all> /row=float

      box='Transaction and CI1_T';

Super Contributor
Posts: 395

Re: merged first cell in proc tabulate

Thanks Cynthia, worked perfectly... would you know how I can make the percent not be multiplied by 100. and show as 0.352 rather than 35.2 ?  Thanks

PROC Star
Posts: 7,363

Re: merged first cell in proc tabulate

I posted a response to the latter question under a second thread that was started on the topic of podarum's second question.  A solution, that worked, was to created and apply a format, namely:

data fractions;

  format label 4.3;

  retain fmtname 'fraction' type 'n';

  do start=0 to 100 by .1;

    end=start+0.0999999999;

    label=start/100;

    output;

  end;

run;

proc format cntlin=fractions;

run;

Super User
Posts: 9,687

merged first cell in proc tabulate

You need another format to display it.

proc format;
picture per
        low-high='9.99' (mult=1);
run;
proc tabulate data=sashelp.class ;
class sex age;
table sex=''*(age='' all),n pctn*format=per. ;
run;


Ksharp

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