Help using Base SAS procedures

What is this PROC TABULATE Doing?

Reply
anonymous_user
Posts: 0

What is this PROC TABULATE Doing?

Hi, I am new to SAS Syntax. Would someone mind please explaing row by row what this code is doing as this would benefit me in understanding it? 

 

proc tabulate data = mortbib.mortgagebible_201606 missing;
class acc_status_1 start_date prod_class region curr_ind_ltv /preloadfmt order=data mlf;
Var bal_sasout;
table (prod_class="" all="TOTAL TOTAL") ,
(curr_ind_ltv="" all="Bottom Total") *
(acc_status_1="") *
(start_date="") ,
(sum="£££"*f=comma19. rowpctsum="%" n="#" min max mean std) *
(region="" all="Right Total") *
(bal_sasout="") /box=_page_;
format region $region. curr_ind_ltv ltv_band. prod_class $pclass. start_date sdates.;
run;

 

Thanks in advance

Super User
Posts: 5,509

Re: What is this PROC TABULATE Doing?

Posted in reply to anonymous_user

Here's a good starting point to begin your studies:

 

http://www.lexjansen.com/nesug/nesug89/NESUG89003.pdf

 

 

SAS Super FREQ
Posts: 8,866

Re: What is this PROC TABULATE Doing?

Posted in reply to anonymous_user

Hi,

  You are the only one, with the data and the user defined formats. No one can run this program without making both the data AND the formats. In addition, the program is using PRELOADFMT and multi-label formats (MLF), which are more advanced uses of formats with PROC TABULATE.

  In brief, the CLASS statement is "declaring" which variables will be used to set categories for grouping; the VAR statement is "declaring" which variable will be used for analysis and then the TABLE statement is specifying what the table structure of the report table will look like. The FORMAT statement is using formats to further format several of the variables for output, without seeing the formats, it is hard to explain what the formats are doing, since PRELOADFMT and MLF is specified for ALL the CLASS variables, to explain the format, someone would have to see the PROC FORMAT code and the data to explain what that was doing.

  PROC TABULATE follows very strict rules for structure:
TABLE xxxxx; (no commas = column dimension)
TABLE yyyy,xxxxx; (1 comma = yyyy in row dimension and xxxxx in column dimension)
TABLE zzzz, yyyy, xxxxx; (2 commas = zzzz in page dimension, yyyy in row dimension, xxxxx in column dimension) .

  But where I have ZZZZ and YYYY and XXXXX, you could have variables, keyword statistics and table operators and the ALL "summary" variable. So the bottom line is that you almost need to "deconstruct" the PROC TABULATE syntax and simplify it.
 
cynthia

 

Something like this -- a much simplified version of your table showing the relationship between the dimensions:

tabulate_example.png

Ask a Question
Discussion stats
  • 2 replies
  • 211 views
  • 0 likes
  • 3 in conversation