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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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