I am fairly new to sas and I am wrapping my head around this problem. I have two tables A and B. The first one collects information about customers in terms of their purchases and the specific products they purchased
A
| Customer_id | product_code |
|---|---|
| 1111111 | 12345 |
| 1111111 | 34523 |
The second one is some sort of a dictionary, i.e. contains old and new codes, the old code being the key and the new one the updated version.
B
| old | new |
|---|---|
| 34523 | 22256 |
| 89765 | 76576 |
My goal would be to update in table A, all the references to old codes with their updated (new) version. In the end A should look like
| Customer_id | product_code |
|---|---|
| 1111111 | 12345 |
| 1111111 | 22256 |
The approach that I wuld take in this example is the following (pseudo-code)
if A.product_code in B.old then
A.product_code = B.new
else
nothing
But I am struggling a bit with sas synthax to implement that.
I really hope that my issue is clear enough and do not hesitate to ask further clarification if necessary.
Thanks to anyone who is willing to participate
Aucun commentaire:
Enregistrer un commentaire