BookmarkSubscribeRSS Feed
Ady23
Calcite | Level 5

I want to generate a report using PROC TABULATE,

It will contain sum and average of the variables specified in class.

I am able to calculalte sum, but couldnt generate mean/average

 

title "Credit Sentry Report";

proc tabulate data=CreditSentryFlag3 missing;

format applicationdate weekdate17.;

class flagname applicationdate /descending;

table flagname='' all='Total', (applicationdate='')*(N='') (all='SUM')*(N='#') ;

run;

 

I want to add an extra column average next to sum.

 

Thanks in advance for help

 

 

--ADITYA

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Since I don't know PROC TABULATE, I can't fix your code. However, the whole thing is very easy to do in PROC SUMMARY or PROC REPORT, and I could provide example code for either of those.

--
Paige Miller
Ady23
Calcite | Level 5
If any of those PROC helps me get the sum and mean or average, i`ll wil happy to use it, can you please provide the steps.
PaigeMiller
Diamond | Level 26

Okay, well I need a little clarification from you.

 

What is the name(s) of the continuous variable you want to sum and average? It seems like you have only specified class variables in the code you show above. And you want both flagname and applicationdate to be class?

--
Paige Miller
Cynthia_sas
SAS Super FREQ

HI:
You need to have a VAR statement with an analysis variable in order to get the MEAN statistic. It doesn't make sense to get the mean of either applicationdate or flagname. There must be a numeric variable someplace in your data that is the one you want the MEAN statistic for.

 

proc tabulate data=sashelp.shoes;
where product in ('Boot' 'Sandal' "Men's Dress" "Women's Dress");
class product region ;
var sales;
table region='Region' all='Total', 
      (product='')*(N='') (all='SUM')*(N='#') sales*mean;

run;



Cynthia

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
  • 4 replies
  • 6510 views
  • 1 like
  • 3 in conversation