In a dataset containing sales data with three different products on daily basis.
I want to calculate sales subtotal for each of the product grand total.
Looking for SAS code.
Follow the guidance below the Post button - post example test data in the form of a datastep, use the {i} button above the post area to post code to retain formatting. Show what you want out at the end. Show logs/code you have done and where you are having diccifulties. Avoid writing in bold an mixed colors.
To do subtotals, you have several options, proc means, summary, proc sql sum() group by, datastep retain count variable. They are each useful in different scenarios.
Finally this a Q&A forum not a contract work request page.
Examine the data set that comes out of this:
proc summary data=have;
class product;
var amount;
output out=stats sum=;
run;
It will contain what you ask, but you will need to study a little to figure out the various pieces of the output. If you want to use SAS, this is a tool you must master.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.