BookmarkSubscribeRSS Feed
sarahsasuser
Quartz | Level 8

Hi,

I ran the following proc, but want the total frequency into the dataset. In the dataset below there is a building that has a status of both OK and Overdue. In the output the row total is shown so that I know  2 are listed as overdue and 2 are listed as OK, for a total of 4. How do I get a row total in the dataset?

proc freq data=have;

     tables var1*var2/ out=freq ouptct;

run;

I get the following dataset:

var1   var2    count  %total %Row %Column

A40     OK      1       0.79     100     4.54

A28    OK       2       1.58      100     9.09

A10    overdue 2      0.79       50      4.54

A10     OK      2       2.38       50      4.54

2 REPLIES 2
Reeza
Super User

1. Use the ODS output instead

2.  Use proc tabulate instead

3. Calculate manually.

Option 1 or 2 would be my suggestions.

Ksharp
Super User

For getting some summary statistical estimators , SQL is a good tool.

select var1,var2,(select count(*) from have where var1=a.var1  ) as total

from have as a

  group by var1,var2  ;

Ksharp

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1335 views
  • 0 likes
  • 3 in conversation