Sample 24785: Using UPDATE to add changes to a master data set
Use the UPDATE statement with the IN= option to update the
master phone list with new phone numbers in the CHANGES
dataset.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data master;
input phone $1-12 name $14-30;
datalines;
919-552-0589 Jason Mesquite
919-552-2222 Jeremy Todd
919-552-2323 Josh Tablet
;
data changes;
input phone :$12. newphone :$12.;
datalines;
919-552-2222 919-557-2222
919-552-2323 919-557-2323
;
data master(keep=phone name);
update master(in=a) changes(in=b);
by phone;
if a and b then phone=newphone;
run;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Obs phone name
1 919-552-0589 Jason Mesquite
2 919-557-2222 Jeremy Todd
3 919-557-2323 Josh Tablet
Use the UPDATE statement with the IN= option to update the
master phone list with new phone numbers in the CHANGES
dataset.
| Type: | Sample |
| Topic: | SAS Reference ==> Statements ==> File-handling ==> UPDATE SAS Reference ==> DATA Step
|
| Date Modified: | 2005-12-08 11:34:34 |
| Date Created: | 2004-09-30 14:09:14 |
Operating System and Release Information
| SAS System | Base SAS | All | n/a | n/a |