BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

I'm quite new of Sas (I've finished my first traingin two weeks ago)....so I'm sorry if I write in the wrong section.
I have an issue with the sum of the observations of a variable: I would like to sum all the observations of a variable in order to get a final result to save in a new variable.
This is what I want but I don't know how....
May someone help me?
Thanks in advance
3 REPLIES 3
Paige
Quartz | Level 8
PROC MEANS or PROC SUMMARY or PROC UNIVARIATE will provide you with the sum of a variable. The OUTPUT statement will provide the result in a SAS data set for you to use.
deleted_user
Not applicable
Thank yoy very much! I used the proc univariate and now it works-->

proc univariate data=sasuser.PBZ_BCSI_Q2_2;
var New_weight;
output out=weight
sum=tot_weight;
run;

Now I'm gonna using "merge" to use the proc univariate result (sum) in some other operation inside my data set "sasuser.PBZ_BCSI_Q2_2.
SASPhile
Quartz | Level 8
share an example of what you are looking for.

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