BookmarkSubscribeRSS Feed
newbi
SAS Employee
Is there a Rollup (sql function) or similar function in SAS to get the total or subtotal ?

Thanks
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
IN PROC SQL, there are several. Check the documentation for "summary functions." I don't recall one being called "rollup", but SUM provides subtotals or a total.
Cynthia_sas
SAS Super FREQ
Hi:
In addition to Doc's suggestion, SAS has reporting procedures like PROC MEANS, PROC TABULATE and PROC REPORT that will produce summary reports (that would only show the subtotals and/or grand totals). PROC REPORT and PROC PRINT have the ability to create "detail" reports where the subtotals and grandtotals are added to the report as extra summary lines. (For purposes of explanation, a detail report contains one report row for every observation in your original dataset or subset, with additional summary lines added to the report; a summary report contains one report row for every summarized group of observations, with additional summary lines added to the report for subtotals and grand totals.)

Some SQL queries are used for reporting purposes, and if this is your goal, then you might investigate the SAS reporting procedures mentioned above (to name just a few).

cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

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
  • 3708 views
  • 0 likes
  • 3 in conversation