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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.