How to sum vertically with missing values

I need to sum a column vertically which could have missing values. sometimes one dataset (dataset 3) is empty as there are no observations. once I have that done I need to sum those weights (verical sums) horizontally.

I am not sure which procedures to use to accomplish this task. please advise.

Re: How to sum vertically with missing values

Do you know how to get a grand total for just one data set? As you might expect, SAS provides a variety of tools for that. You should learn at least one method if you expect to program with SAS, instead of relying on the board to program basic functionality for you.

Re: How to sum vertically with missing values

Please provide your source data always via a working SAS data step so we don't have to do this for you.

As for your question: You could first combine all your source data sets into one and and an additional variable which holds the name of the source data set. You then can use this additional variable as a classification/grouping variable in any of the SAS Procs which can return the result you're after.

I'm using Proc Tabulate in below sample code but you could also use other Procs like Proc Means, Proc Report or Proc SQL.

Re: How to sum vertically with missing values

Do you know how to get a grand total for just one data set? As you might expect, SAS provides a variety of tools for that. You should learn at least one method if you expect to program with SAS, instead of relying on the board to program basic functionality for you.

Re: How to sum vertically with missing values

Thank you all for your help. It works. Unfortunately, I have big datasets, so that is the reason I couldn't send original file. But the same logic works. Thanks all for helping me.

We don't want "big datasets" we want enough to exercise the logic. What is extremely helpful is providing data in the form of a data step.

With a data step we know the variable types and lengths. We have spend lots of time working on requests and after 10 or 15 responses the original poster finally admits that a value that looked numeric was actually character, or that looked character was the result of a format.