I am trying to create a field called Varience that is Actual Payments minus Original Forecast (Trantype). All of my numbers below are made up of a transaction 'amount' with a 'trandate'. I am trying to use my existing data sets to pull in all the Actual Payments, another data set with Original Forecast, then a dataset where I try to create the 'Trantype' of Variance, subtracting a.amount from b.amount.
Below is an example of what I am trying to do for code. My data is working with the seperate data sets, but when I join and plave into my Qlikview report, I am not getting the results I want. The trantype is not ending up as "Variance".
you should use "merge" instead of "set".
The code looks correct to me, so its changing somewhere else.
I don't know what you mean by this though:
"but when I join and plave into my Qlikview report"
Are you getting a message in the log about variable trantype already in the data set? You have 3 versions, one from each input set a and b and the one you create with "as". A quick test with small data sets makes me bet you are getting the trantype as 'ActualPayments'. Drop the trantype from the two input sets and retry.
Ok let me simplify what I am coming accross right now. I have 2 data sets right now, one has "amount1" and the other "amount2". Both are formatted as numeric and I am looknig for the format to subtract 1 from 2. I thought I knew what it is, but I am not receiving any results. What am I doing wrong?
Sorry in the example it shows I am adding, but this was just a test to see if even that worked.
you should use "merge" instead of "set".
Thanks Linilin, I was just experimenting with this when I saw your reply. It looks like I am getting the results I want now.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.