Hi,
I am a developer who is new to SAS.
I have a table, myData that has three columns, BAL1, BAL2, and RUNOFF.
How can I easily, via some kind of datastep or proc SQL, update the RUNOFF = (BAL1-BAL2) (for all of the rows)?
There are no more that 50,000 rows / obs in myData.
Many Thanks
Kody_Devl
Hi,
You may want to run through the SAS free online videos to get a graps of the language if you are new:
data want; set have; runoff=bal1-bal2; run;
Assumes of course that all three variables are the same type = numeric. It doesn't matter the number of observations - much like a cursor in SQL, a datastep is a loop of ever observation in the dataset, so that formula gets applied to each row.
It didn't work.
The Bal1 and Bal2 and RunOff are all Numeric 8
BEFORE UPDATE:
Bal1 Bal2 RunOff
-154385 0 0
AFTER UDPATE;
Bal1 Bal2 RunOff
-154385 0
I then ran a query to Calculate RunOff and the query returned the same results for RunOff, Blank
Code Used:
data Work.Data_P2_0;
set Work.Data_P2;
runoff=PremiumWO0-PremiumWO1;
run;
No Errors: 0
No Warnings: 0
This is why I am asking for help.
This shouldn't be that hard but somthing is wrong.
Could it be some kind of formatting problem on the numeric 8 field.
The Zero fields were created by SQL when the table is created
0 as PremiumWO1
0 as RunOff
??
Post some test data, follow this post for how to get it:
Also, post the log of the operation.
I have imported the code but am having trouble with the correct parameters to get it to work. I will have to play with it a bit.
Thanks
Kody_devl
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.