The 'master' dataset became 'non audit-able' after the updating process. Is there any way to make the 'master' dataset audit-able? Anyone can help? Thanks.
data master;
input id $ name $ gender $ weight;
datalines;
01 Perry M 165
02 Miller M 145
03 Davis F 127
;
run;
data transact;
input id $ name $ gender $ weight;
datalines;
02 Miller . 160
03 Bush . 157
05 Elliot F 125
02 . M 170
;
run;
proc sort data=master; BY id; RUN;
proc sort data=transact; BY id; RUN;
proc datasets lib=work;
audit master;
initiate;
user_var _reason_change_ $30;
quit;
data master;
update master transact;
by id;
run;
data auditchk;
set Master(type=audit);
run;
You will need a method to update the MASTER that does not create a new data set. MODIFY.
You have to program how the updates are done using _IORC_ and you may want to use the %sysrc macro too.
data master;
modify master transact;
by id;
if _iorc_ eq 0 then do;
_reason_change_ = 'Updt';
replace;
end;
else if _iorc_ eq 1230013 then do;
_reason_change_ = 'new';
output;
end;
else do;
errmsg=IORCMSG();
putlog 'NOTE: ' errmsg= _iorc_=;
end;
run;
What does _iorc_ eq 1230013 mean? Any website for reference? Thanks.
_iorc_ eq 1230013
is an expression. It returns 1 when true and 0 when false.
This website will be helpful for a SAS user.
Must it be 1230013? I got a different answer when change it to other number, such as 1230033.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.