BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MalcolmCICWF
Calcite | Level 5

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. Capture.JPG

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".

Untitled.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Linlin
Lapis Lazuli | Level 10

you should use "merge" instead of "set".

View solution in original post

6 REPLIES 6
Reeza
Super User

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"

ballardw
Super User

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.

MalcolmCICWF
Calcite | Level 5

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?

Capture.JPG

MalcolmCICWF
Calcite | Level 5

Sorry in the example it shows I am adding, but this was just a test to see if even that worked.

Linlin
Lapis Lazuli | Level 10

you should use "merge" instead of "set".

MalcolmCICWF
Calcite | Level 5

Thanks Linilin, I was just experimenting with this when I saw your reply. It looks like I am getting the results I want now.

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1532 views
  • 1 like
  • 4 in conversation