BookmarkSubscribeRSS Feed

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

2 REPLIES 2
Astounding
PROC Star

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

 

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

 

 

Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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