Skip to content

Conversation

gordonkeener
Copy link

Utility macro to generate a random "password" by appending random
characters to a string until it reaches the desired length.

Usage:

%MACRO RANDPASS(len=24,digits=1,special=%NRSTR(@%&#!?.-_+*,/;:));

where:
len= is the desired length, defaulting to 24
digits= when TRUE (non-zero), the default, digits 0-9 are included
special= is a string of non-alphanumeric characters to also choose from

My macro demonstrates trickery to make & and % characters work in the special
list, but I do not support ' " ( or ) as special characters.

This file contains the macro, a simple test macro to test it, and a silly example
that uses it to generate an encryption key for a temp table.

Signed-off-by: Gordon L Keener gordon.l.keener@gmail.com

Signed-off-by: Gordon L Keener <gordon.l.keener@gmail.com>
@stever-sas
Copy link
Collaborator

Thanks, Gordon! I did test in Viya, and it looks good. I'll merge the PR, then update the comment block.

@stever-sas stever-sas merged commit fb8b273 into sassoftware:main Jun 5, 2025
1 check failed
@gordonkeener
Copy link
Author

gordonkeener commented Jun 5, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants