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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: