Desktop productivity for business analysts and programmers

How Do I Sum a column that is a calculated by two other columns

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

How Do I Sum a column that is a calculated by two other columns

[ Edited ]

Hi,

 

Is it possible during the proc sql code below to add another column which would be 'Total' (Bal1+BAl2+BAl3)-(Bal4+Bal5+Bal6+BAl6)

 

Or to do it as a seperate data step after the output of the following code?

 

proc sql;
connect to &ABCD as ABC(ACCDE);
create table TestBal as
select *
from connection to ABC
(
select
AccountNum as Accno,
Bal1,
Bal2,
Bal3,
Bal4,
Bal5,
Bal6,
Bal7,
Load_Date


from Table.Dataset

order by Accno

);
disconnect from ABC;
quit;


Accepted Solutions
Solution
‎11-23-2016 10:15 AM
Super User
Posts: 7,431

Re: How Do I Sum a column that is a calculated by two other columns

select
AccountNum as Accno,
Bal1,
Bal2,
Bal3,
Bal4,
Bal5,
Bal6,
Bal7,
Load_Date,
(Bal1+BAl2+BAl3)-(Bal4+Bal5+Bal6+BAl6) as Total
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎11-23-2016 10:15 AM
Super User
Posts: 7,431

Re: How Do I Sum a column that is a calculated by two other columns

select
AccountNum as Accno,
Bal1,
Bal2,
Bal3,
Bal4,
Bal5,
Bal6,
Bal7,
Load_Date,
(Bal1+BAl2+BAl3)-(Bal4+Bal5+Bal6+BAl6) as Total
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 6

Re: How Do I Sum a column that is a calculated by two other columns

Thank You Very Much
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 185 views
  • 0 likes
  • 2 in conversation