BookmarkSubscribeRSS Feed
sconn
Calcite | Level 5

proc sort data=Final
out=Final3;
by state;
proc print data=final3;
var id name date manner_of_death armed age gender race city state flee body_camera;
where state in ('MA', 'CT', 'NH', 'VT', 'ME', 'RI');

sum 
by state;
pageby state;
run;

 

So, I am trying to get count totals on the bottom of my tables for each page (attached) of the amount of records there. I do not want to sum any number...how do I do that??


SAS.png
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
I'm not exactly sure what you want, but you can try the N option on your PROC PRINT statement:
proc print data=final3 n;

cynthia
sconn
Calcite | Level 5

I was looking for a summary for a total number on each state. If you look at my attachment where the n= is I want an area saying 'Total Number of' with the count of records for that page.


SAS.png
Reeza
Super User

SUMLABEL on the PROC PRINT statement. 

 

The documentation has an example of this implementation for PROC PRINT. 

 

http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#p0f022tve3mt0tn162itr...

 

PROC PRINT has SUM or SUMBY statements,  but you seem to have SUM BY(space). Check the log to see if SAS is correcting this for you, but it's good to be explicit in your syntax. 

Reeza
Super User

And if you don't have a record you want to SUM add a dummy variable that has a value of 1 to each record and use that but don't display it. 

I think that would work, but haven't tested it. 

Cynthia_sas
SAS Super FREQ
Dummy variable would not work for PROC PRINT, but would work with PROC REPORT.

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!

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