Help using Base SAS procedures

How to do a subtraction from col a to col b

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 80
Accepted Solution

How to do a subtraction from col a to col b

Hi I have a table that looks like this
Id. DollarA. Dollar B
1. 10. 45
2. 50. 35
3. 20. 25
I need it to look like this
. DollarA. Dollar B. DIFF
1. 10. 45. 35
2. 50. 35. 15
3. 20. 25. 5

Thanks for assistance

Accepted Solutions
Solution
‎07-17-2016 10:17 PM
Super Contributor
Posts: 441

Re: How to do a subtraction from col a to col b

Looks like you need the absolute value of the difference:

 

diff=abs(a-b);

- Jan.

View solution in original post


All Replies
Super User
Posts: 19,822

Re: How to do a subtraction from col a to col b

Diff = b - a;

Solution
‎07-17-2016 10:17 PM
Super Contributor
Posts: 441

Re: How to do a subtraction from col a to col b

Looks like you need the absolute value of the difference:

 

diff=abs(a-b);

- Jan.

Frequent Contributor
Posts: 80

Re: How to do a subtraction from col a to col b

Thank you -Jan
☑ This topic is solved.

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

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