The SAS Output Delivery System and reporting techniques

Random password in PDF using SAS code

New Contributor
Posts: 3

Random password in PDF using SAS code

I am challenging trying to create random passwords in PDFPASSWORD. It does not allow me use any of the random functions available in SAS to generate a random letters. Take for example:


The general syntax is:




When you try any mathematical functions or random function, it doesn't work, instead it returns vebatim the function instead of returning the resolved variable. For instance...


PDFPASSWORD = (OPEN="PASSWORD" OWNER=RAND(2)); your password will be RAND(2)

It does not resolve the function .


Another Instance...

PDFPASSWORD = (OPEN="PASSWORD" OWNER=MOD(2**5-1)); your password will be MOD(2**5-1)


Can any body please help. I want to send out pdf passworded document to over 200 employees with different random generated passwords.






Super User
Posts: 13,523

Re: Random password in PDF using SAS code

Generate the random password in a datastep and assign the value to a macro varible that is referenced in the PDFPassword options or to generate Call Execute statements to complete the whole document.

I would be tempted to use this so that I would have a dataset with the password that is available later when the file can't be opened because the password was forgotten/lost or unknown in the first place by the user.


Here's something to think about: If the random function were allowed in the code how would you know what the value was to open the file later?

New Contributor
Posts: 3

Re: Random password in PDF using SAS code

Thanks Ballardw 

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation