BookmarkSubscribeRSS Feed
helloSAS
Obsidian | Level 7

is there is simple or better way to do this kind of report

proc summary data=archdd;
class risk;
output out=x;
run;


data y;
set x;
format risk1 $5.;
risk1 = risk;
if _type_ = 0 then risk1 = 'Total';
drop _type_ risk;
rename risk1 = risk;
run;

I want the report to look like

Risk     _freq_

High     4646

Med      1564    

Lo         1889

Total     8099

2 REPLIES 2
PGStats
Opal | Level 21

You could use proc tabulate.

proc tabulate data=archdd;

class risk;

table risk all, n="";

run;

PG

PG
Reeza
Super User

You can use a Multilabel Format (MLF) with proc summary. You should be able to get the right order as well with an order= setting somewhere or preloadfmt option.

Base SAS(R) 9.3 Procedures Guide, Second Edition

data have;

input level count;

cards;

1 1889

2 1564

3 4646

;

run;

proc format;

    value level_fmt (multilabel)

        1 = 'Low'

        2 = 'Medium'

        3 = 'High'

        1,2,3='Total';

run;

proc means data=have mean;

class level /mlf;

var count;

weight count;

format level level_fmt.;

run;

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!

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.

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