Utilisez UPDATE plutôt que MERGE pour vos flux de gestion de comptes ou d'inventaires. Si vous devez absolument forcer le remplacement d'une valeur existante par un vide (par exemple, pour annuler un champ), vous pouvez utiliser l'option UPDATEMODE=NOMISSINGCHECK, mais manipulez-la avec précaution pour ne pas corrompre vos données historiques par inadvertanc
Type : CREATION_INTERNE
Les exemples utilisent des données générées (datalines) ou SASHELP.
| 1 | DATA master; |
| 2 | INPUT common $ animal $ plant $; |
| 3 | DATALINES; |
| 4 | a Ant Apple |
| 5 | b Bird Banana |
| 6 | c Cat Coconut |
| 7 | d Dog Dewberry |
| 8 | e Eagle Eggplant |
| 9 | f Frog Fig |
| 10 | ; |
| 11 | RUN; |
| 12 | |
| 13 | DATA plantNew; |
| 14 | INPUT common $ plant $; |
| 15 | DATALINES; |
| 16 | a Apricot |
| 17 | b Barley |
| 18 | c Cactus |
| 19 | d Date |
| 20 | e Escarole |
| 21 | f Fennel |
| 22 | ; |
| 23 | RUN; |
| 24 | |
| 25 | DATA master2; |
| 26 | update master plantNew; |
| 27 | BY common; |
| 28 | RUN; |
| 29 | PROC PRINT DATA=master2; RUN; |
| 1 | DATA master; |
| 2 | INPUT common $ animal $ plant $; |
| 3 | DATALINES; |
| 4 | a Ant Apple |
| 5 | b Bird Banana |
| 6 | c Cat Coconut |
| 7 | d Dog Dewberry |
| 8 | e Eagle Eggplant |
| 9 | f Frog Fig |
| 10 | ; |
| 11 | RUN; |
| 12 | |
| 13 | DATA plantNewDupes; |
| 14 | INPUT common $ plant $; |
| 15 | DATALINES; |
| 16 | a Apricot |
| 17 | b Barley |
| 18 | c Cactus |
| 19 | d Date |
| 20 | d Dill |
| 21 | e Escarole |
| 22 | f Fennel |
| 23 | ; |
| 24 | RUN; |
| 25 | |
| 26 | DATA master; |
| 27 | update master plantNewDupes; |
| 28 | BY common; |
| 29 | RUN; |
| 30 | PROC PRINT DATA=master; RUN; |
| 1 | DATA master; |
| 2 | INPUT common $ animal $ plant $; |
| 3 | DATALINES; |
| 4 | a Ant . |
| 5 | c Cat Coconut |
| 6 | d Dog Dewberry |
| 7 | e Eagle Eggplant |
| 8 | f Frog Fig |
| 9 | ; |
| 10 | RUN; |
| 11 | |
| 12 | DATA minerals; |
| 13 | INPUT common $ plant $ mineral $; |
| 14 | DATALINES; |
| 15 | a Apricot Amethyst |
| 16 | b Barley Beryl |
| 17 | c Cactus . |
| 18 | e . . |
| 19 | f Fennel . |
| 20 | g Grape Garnet |
| 21 | ; |
| 22 | RUN; |
| 23 | |
| 24 | DATA master; |
| 25 | update master minerals; |
| 26 | BY common; |
| 27 | RUN; |
| 28 | |
| 29 | PROC PRINT DATA=master; RUN; |
| 1 | DATA master; |
| 2 | update master minerals updatemode=nomissingcheck; |
| 3 | BY common; |
| 4 | RUN; |
| 5 | PROC PRINT DATA=master; |
| 6 | title "Updated Data Set master"; |
| 7 | title2 "With Values Updated to Missing"; |
| 8 | RUN; |