简体   繁体   中英

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

You just need to wrap it in a datastep:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM