/***************************************************************************************************************** SAS file name: update_statement File location: _________________________________________________________________________________________________________________ Purpose: To demonstrate the UPDATE statement in the SAS data step. Author: Peter Clemmensen Creation Date: 05/04/2019 This program supports the example page "Using the Update Statement in SAS by Example" on SASnrd.com *****************************************************************************************************************/ /* An Introdoctory Example */ data Master; input ID $ Value; datalines; 1 1 2 2 2 2 3 3 4 4 5 5 ; data Trans; input ID $ Value; datalines; 1 10 2 20 4 10 4 20 4 30 5 . 6 60 ; data want; update Master Trans updatemode=missingcheck; by ID; run; proc print data=want; run; /* Update Vs Merge Statement */ data MergeWant; merge Master Trans; by ID; run; /* Replace missing values with previous */ data MyData; input ID $ Value; datalines; 1 2 1 . 1 . 1 4 2 . 2 9 2 . 2 . 3 3 3 . 3 0 ; data Want; update MyData(obs=0) MyData; by ID; output; run;