Freaky_foxx
Freaky_foxx

Reputation: 43

How to calculate addition and subtraction in sas

How to calculate this below

Used below formula in Microsoft excel

   C = col1-col2- col3 + col4

I used below logic to convert above formula into SAS

   C1 = col1-col2
   C2 = sum(col3,col4)
   C1= C1-C2

Still not able to match value with Microsoft excel output

Upvotes: 1

Views: 2664

Answers (1)

LuizZ
LuizZ

Reputation: 1044

You just need to wrap it in a datastep:

data new_data;
   set old_data;
   C = col1 - col2 - col3 + col4;
run;

Upvotes: 2

Related Questions