Hi All,
Would someone please explain how the missing records section work? Thank you for your help.
declare hash hct(dataset: 'work.etls_compare_digest', hashexp: 10);
hct.defineKey("sourcedb_id", "case_id");
hct.defineData("sourcedb_id", "case_id", "compare_digest");
hct.defineDone();
end;
set work.W1PAEO8L end = eof;
/* create digest - version 2.1 */
source_digest = put(md5(catq(' ', contact_id, subject_id, owner_id, owner_name, case_name, Season,
case_priority, case_notes, case_state_code, case_status_code,
case_status_desc)), $hex32.);
/* source/compare match */
if hct.find() eq 0 then
do;
/* source/compare match: Unchanged records */
if source_digest eq compare_digest then
output work.WGK73ZRO;
/* source/compare match: Changed records */
else if source_digest ne compare_digest then
output work.WGK73X4D;
/* remove found key + data */
hct.remove();
end;
/* source table: New records */
else if hct.find() ne 0 then
output work.WGK73YG2;
/* Missing records */
if eof then
rc = hct.output(dataset: 'work.WGK7411D(drop = compare_digest)');
You told SAS to set a flag when your were reading the last observation in your SET statement.
set work.W1PAEO8L end = eof;
Then when you get to the last observation you write out the remain records from the hash object. You ave added dataset options to drop one of the variables.
if eof then
rc = hct.output(dataset: 'work.WGK7411D(drop = compare_digest)')
;
You told SAS to set a flag when your were reading the last observation in your SET statement.
set work.W1PAEO8L end = eof;
Then when you get to the last observation you write out the remain records from the hash object. You ave added dataset options to drop one of the variables.
if eof then
rc = hct.output(dataset: 'work.WGK7411D(drop = compare_digest)')
;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.