Assume we have a table P_DEF in which we want to update the value of column RUN_ID for a certain subset which we stored in another table TMP. Here how I would do it in SQL:
update P_DEF
set RUN_ID = (-1) * TMP.RUN_ID /* change the sign of the value */
from P_DEF
inner join TMP
on P_DEF.RUN_ID = TMP.RUN_ID
and P_DEF.ITEM_ID = TMP.ITEM_ID
and P_DEF.ITEM_TITLE = TMP.ITEM_TITLE
Now the big question: To my knowledge, a proc SQL does not support this kind of filtered update. So how do I do this with a minimal number of transformations in SAS DI(S)?
Update by join is not supported by SAS SQL, but you can do CORRELATED UPDATE: update by values from correlated subquery:
The correlated update is not sufficient when there are non-matches, so you need to add filter to only update matched rows. When joining on multiple columns, I usually rely on catx to get unique values (depending on you data, you might need to use different numeric formats in put functions):
The version above is slightly different from your exact example to show how to get value from subquery - the NEW_ID column.
Simplified version where you only use lookup table to identify rows to be updated is this:
As you can see, the correlated update might need two subqueries to update single column, so don't expect it to be perfomant on bigger tables. You might be better with data step methods: MERGE, MODIFY or UPDATE statements.
As for SAS Data Integration Studio tranformation you asked for, I believe you can achieve this with SCD Type 1 Loader, this will generate some of the code I mentioned.