BookmarkSubscribeRSS Feed
scb
Obsidian | Level 7 scb
Obsidian | Level 7

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;

4 REPLIES 4
data_null__
Jade | Level 19

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;
scb
Obsidian | Level 7 scb
Obsidian | Level 7

What does _iorc_ eq 1230013 mean? Any website for reference? Thanks.

data_null__
Jade | Level 19
_iorc_ eq 1230013 

 

is an expression.  It returns 1 when true and 0 when false.

 

This website will be helpful for a SAS user.

http://support.sas.com/documentation/index.html

scb
Obsidian | Level 7 scb
Obsidian | Level 7

Must it be 1230013? I got a different answer when change it to other number, such as 1230033.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 931 views
  • 0 likes
  • 2 in conversation