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.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1510 views
  • 0 likes
  • 3 in conversation