Is it possible to update a selection of variables within a dataset as opposed to every variable contained in a table? In my case, I have a dataset with blank fields for several variables which I want to fill with current values from a table. Here is my current code:
data accounts;
update set1 Master;
by accountnumber;
run;
I am creating a new dataset (accounts) that updates values from another data source (Master) for particular variables in my current dataset (set1) by the accountnumber field. Is it possible to declare particular fields in my set1 dataset for the update statement? When I run my code, it brings in EVERY field that is in the Master dataset. I just want to update particular fields. Any assistance would be greatly appreciated. Thanks.
The easiest approach would be to use a dataset option Keep list for the transaction data set (contains update values) if you only want some of those to update the master data set (the one receiving the updates). (Your name is counterintuitive but that is how SAS sees it).
data accounts;
update set1 Master(keep=accountnumber firstvartouse othervartouse);
by accountnumber;
run;
The easiest approach would be to use a dataset option Keep list for the transaction data set (contains update values) if you only want some of those to update the master data set (the one receiving the updates). (Your name is counterintuitive but that is how SAS sees it).
data accounts;
update set1 Master(keep=accountnumber firstvartouse othervartouse);
by accountnumber;
run;
It works. You're right. I'll change the name of that dataset to avoid confusion. Thanks so much.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: