Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_md5.sas File Reference

Generates an md5 expression for hashing a set of variables. More...

Go to the source code of this file.

Detailed Description

This is the same algorithm used to hash records in Data Controller for SAS.

It is not designed to be efficient - it is designed to be effective, given the range of edge cases (large floating points, special missing numerics, thousands of columns, very wide columns).

It can be used only in data step, eg as follows:

data _null_;
  set sashelp.class;
  hashvar=%mp_md5(cvars=name sex, nvars=age height weight);
  put hashvar=;
run;

Unfortunately it will not run in SQL - it fails with the following message:

‍The width value for HEX is out of bounds. It should be between 1 and 16

The macro will also cause errors if the data contains (non-special) missings and the (undocumented) options dsoptions=nonote2err; is in effect.

This can be avoided in two ways:

  • Global option: options dsoptions=nonote2err;
  • Data step option: data YOURLIB.YOURDATASET /nonote2err;
Parameters
[in]cvars=() Space seperated list of character variables
[in]nvars=() Space seperated list of numeric variables

Related Programs

Version
9.2
Author
Allan Bowe

Definition in file mp_md5.sas.