Masking Certain Macro Variables

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Masking Certain Macro Variables

I am resolving my ID and Password through macro variables in my SAS code. I am using Option mprint and symbolgen to see the resolved value of other macros in my code. I dont want it to resolve my ID and Password. Is there a way that I can mask these 2 macro variables


Accepted Solutions
Solution
‎05-29-2017 06:06 AM
Super User
Posts: 7,470

Re: Masking Certain Macro Variables

#1 disable mprint and symbolgen immediately before setting and using the macro variables.

#2 use a masked version of the passwords (proc pwencode)

#3 see if you can adapt your process so that credentials are not needed (ie set up automated ssh connections with public/private key authentication)

 

solution 3 is to be preferred.

 

In places where we need confidential information, this is stored in .sas files only readable by the user in question; these files are %include'd when needed. For security, they have options nomprint nosymbolgen set (so no public log will show the values).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎05-29-2017 06:06 AM
Super User
Posts: 7,470

Re: Masking Certain Macro Variables

#1 disable mprint and symbolgen immediately before setting and using the macro variables.

#2 use a masked version of the passwords (proc pwencode)

#3 see if you can adapt your process so that credentials are not needed (ie set up automated ssh connections with public/private key authentication)

 

solution 3 is to be preferred.

 

In places where we need confidential information, this is stored in .sas files only readable by the user in question; these files are %include'd when needed. For security, they have options nomprint nosymbolgen set (so no public log will show the values).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 6

Re: Masking Certain Macro Variables

Thank You Sir!!
Super User
Super User
Posts: 6,851

Re: Masking Certain Macro Variables

If you are using the password in a LIBNAME statement then you should also consider using the LIBNAME() function in a data step instead.  You can use the SYMGET() function to retrieve a macro variable value without it being displayed.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 119 views
  • 0 likes
  • 3 in conversation