Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Sum the values of a variable to get the result lik...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-2010 11:23 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-2010 11:45 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-06-2010 03:09 AM

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.

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-2010 02:19 PM

share an example of what you are looking for.