08-08-2012 04:19 PM
I am a novice SAS user. I am trying to calculate simple numerical differences (current variable value minus prior variable value) for certain variables common to two separate SAS datasets. However, in this case, the key field values in each dataset that I have to use as a "link" between the two intentionally differ in value. For example, the key value used in dataset one might be 311320 and it's key value counterpart in the other is 311351. As a result, the numerical differences calculated have to be based on using the variable values for these differing keys in each dataset (in others words, 311351 values minus 311320 values). I'm a little stumped and need help.
08-08-2012 05:18 PM
I have a crosswalk of these six-digit codes (there are ten pairs of these currently) that show the older code crosswalked to the newer one (such as old code 311320 crosswalked to new code 311351, 311330 to 311352, etc). Normally, this is not the case with this particular product as difference calculations are simply calculated from matching codes which is a bit easier and more straightforward (311320 to 311320, 311330 to 311330, etc).
However, our program revises these codes once every five years so a situation like the above may come up.
08-08-2012 05:40 PM
Seeing your code and examples of the two datasets would help. You can easily recode values with a simple combination of it then else statements.
08-08-2012 05:38 PM
It sounds like you could make a custom format to put your OLD_KEY into your NEW_KEY values. Then just do a join from the NEW_KEY? It has to know how to join the records. I would try to use PROC FORMAT to do it. If you put it into your new format it will translate the old key to the new.