BookmarkSubscribeRSS Feed
riya275
Obsidian | Level 7

 

proc means data = c1.od noprint nonobs;
var  Total_Media_Value ;
class _probability___/ descending;
output out=data (drop = _TYPE_ _FREQ_)
sum = Total_Budget
n= num_of_optys;
run;

 in the output i am getting a row which gives me total of columns. I want to give  that row a name - Total , how do i do that?

eg- my result looks like this - 

               probability  total budget  num

1	.	3200531	361
2	100	68100	7
3	90	56000	4
4	70	23200	8
5	50	156500	18
6	30	112000	5
7	10	2784731	319

i want the first row at the end and have it named total
2 REPLIES 2
Astounding
PROC Star

In SAS, rows don't have names.  What you will need to do is add a column to the output data set that you named DATA.  For example:

 

data want;

set data;

if _n_=1 then row_name = 'Total';

else row_name = put(_probability___, 5.);

run;

 

Then when you print the data set, you can print ROW_NAME instead of _PROBABILITY___.

Ksharp
Super User

I guessed you only need the total sum.Add NWAY option.

 

proc means data = c1.od noprint nonobs nway;

 

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
  • 2 replies
  • 1628 views
  • 0 likes
  • 3 in conversation