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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.