This guide introduces MD5 and hash functions in general, lists common uses for hash functions, gives advise on how to best use MD5 in SAS, and covers common issues.
This SAS macro performs email address normalization by changing email addresses like First.Lastemail@example.com to the canonical form firstname.lastname@example.org. Also, it demonstrates basic unit testing in SAS, which ensures quality and eases code maintenance. Email address normalization is often used to transform email addresses into unique keys for identifying or preventing duplicate accounts
This SAS macro retrieves the amount of free disk space, and puts the value in the SAS log and in a global macro variable. It works with local and remote drives and mapped and UNC paths. To avoid data loss, use it as a sanity check to verify there is a reasonable amount of disk space before writing data.
Here is code to calculate RMSE and MAE in R and SAS. RMSE (root mean squared error), also called RMSD (root mean squared deviation), and MAE (mean absolute error) are both used to evaluate models. MAE gives equal weight to all errors, while RMSE gives extra weight to large errors.
How much storage space and I/O resources can be saved by using the LENGTH statement to shrink the storage of date and datetimes while maintaining sufficient precision? In my experience, saving I/O generally makes SAS run faster (such as in a DATA step) proportional to the I/O savings, so, for example, a 50% reduction in file size makes SAS run about 50% faster.
A SAS code to generate information about each month such as the number of days in the month, week days, hours, work hours, etc. using intck and intnx function. It’s also a good example of using a DATA step to generate a data set without an input data set (i.e., no SET or MERGE statements).
Here is a macro to generate binary features (also called dummy coding) from a nominal variable (also called a categorical variable, such as eye color). This is also called one-hot encoding and one-of-K encoding. The automation saves time and avoids mistakes when there are many possible values to a category or the values can change.
Today Charlie Huang posted a SAS HTML table sorting demo, but without automation. Here is a fully automated implementation in SAS. The developer does not need to manually edit the HTML, and the user simply clicks any column and it sorts instantly client-side in the web browser. The feature is automatically applied to all SAS tables in the ODS HTML output.
In SAS it’s trivial to perform basic validation of a US phone number using a regular expression, and this SAS macro goes way behind the basic validation rules: it checks several rules, in service area codes, directory service, and special phone numbers. Simple unit testing ensures the macro works as intended.
nnet2sas() version 1 introduced a way to export a nnet() model trained in R to Base SAS through metaprogramming, and now nnet2sas() version 2 introduces support for variable centering and scaling as implemented in caret::train(). See the link for version 1 for more background on nnet2sas(). Update: This function and similar functions are now in…