Hi,
Pls explain me the second point,
Duplicate BY Values
Duplicates in the master and transaction data sets affect processing.
If duplicates exist in the master data set, only the first occurrence is updated because the generated WHERE statement always finds the first occurrence in the master.
If duplicates exist in the transaction data set, the duplicates are applied one on top of another unless you write an accumulation statement to add all of them to the master observation. Without the accumulation statement, the values in the duplicates overwrite each other so that only the value in the last transaction is the result in the master observation
Thanks
Maxim 4 comes into play. Just Try It:
data master;
input id value;
cards;
1 3
1 2
2 2
3 4
4 2
4 1
;
run;
data trans;
input id value;
cards;
1 6
2 4
3 5
3 6
4 7
4 8
;
run;
data master;
modify master trans;
by id;
run;
proc print data=master noobs;
run;
This is the result:
id value 1 6 1 2 2 4 3 6 4 8 4 1
With ID 1, there's a duplicate in the master; only the first observation is updated, the second is unaffected.
With ID 3, there's a duplicate in the trans; only the last of that takes effect in the master.
With ID 4, both trans are worked into the first master, with the second taking effect; the second obs in the master stays unaffected.
Please provide context.
Which documentation are you referring to?
Maxim 4 comes into play. Just Try It:
data master;
input id value;
cards;
1 3
1 2
2 2
3 4
4 2
4 1
;
run;
data trans;
input id value;
cards;
1 6
2 4
3 5
3 6
4 7
4 8
;
run;
data master;
modify master trans;
by id;
run;
proc print data=master noobs;
run;
This is the result:
id value 1 6 1 2 2 4 3 6 4 8 4 1
With ID 1, there's a duplicate in the master; only the first observation is updated, the second is unaffected.
With ID 3, there's a duplicate in the trans; only the last of that takes effect in the master.
With ID 4, both trans are worked into the first master, with the second taking effect; the second obs in the master stays unaffected.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.