@DiogoSilvaBR wrote: Hi. First of all, thank you for your help. Unfortunately your answer does not contain a solution to the case. As I pointed out, this is not the use of merge. I updated the question by attaching an example to VBA. I would appreciate it if you could devote a little more of your time to helping me. Hug!
So which part of the VBA code actually does the balance line part? Remove anything not directly related. I see a bunch of code related to dates, which you did not mention in your question so all of that should be removed or explained in the question in much more detail. SAS has a number of functions involving date values that makes me suspect that corrigeData function wouldn't be needed because of built in functions like YEAR, MONTH and/or DAY.
If any of the code involves calling other functions or subroutines they also need to be defined.
Any part that involves reading external data should likely be removed as that would already be accomplished or you would not have SAS data sets to work with. And a general comment on the VBA code: There is not a single comment. I might guess that comments if included would be Spanish which helps me little but might help someone else and a complete lack should mean this is a trivial exercise.
The code also contains magic number of 1000000 in this block of code:
contar = contar + 1
If contar > 1000000 Then
DoEvents
contar = 1
DoEvents
End If
why is that limit there?
Perhaps you can show step by step what comparisons and results are being used.
Also explain how 8 input records each from two data sets create 10 output records in you your example D3 above. This seemingly contradicts "two ordered tables that have some logic resulting in a match process that resembles "Merge" but without it being possible for a record to match with more than one record from the other table.". How do you get more records out then input if one record isn't being considered a "match" to more than one in another.
... View more