Hi,
I would like to learn how to update a target table with values from another table. There are about 1000 variables in the target table and only about 350 variables (chat or num variables) need to be updated from a renew dataset. The rules are
I have generated a very simple example.
data target;
input id1$ id2 a b c$ d$ e f;
datalines;
1 10 6 8 x1 x2 9 3
2 20 5 . y1 . 6 .
;
run;
data renew;
input id1$ id2 a b c$ d$ e f;
datalines;
1 . 6 8 x10 . 9 30
2 20 . 3 . y20 6 .
;
run;
the data want will be
id1 | id2 | a | b | c | d | e | f |
1 | 10 | 6 | 8 | x10 | x2 | 9 | 30 |
2 | 20 | 5 | 3 | y1 | y20 | 6 | . |
Thank you so much.
data target;
update target renew;
by id1;
run;
Update Statement will meet your requirements :
1. It Does not update the value in the master by default, if the transaction table has missing values.
2. Sets to missing if both master and transaction have missing values
data target;
update target renew;
by id1;
run;
Update Statement will meet your requirements :
1. It Does not update the value in the master by default, if the transaction table has missing values.
2. Sets to missing if both master and transaction have missing values
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.