BookmarkSubscribeRSS Feed
OliveiraMiguelZ
Obsidian | Level 7

First let me explain what I'm trying to do.

I want to download some reports from a server directly from a HTTP get proccess. I already dealt with it using the following code:

 

PROC HTTP
    URL='...'
    METHOD='get'
    Out=OutFIle
    WebUserName='' /* <--- Avoid */
    WebPassword='' /* <--- Avoid */
    ;
Run;

 

The problem are the web authentication parameters. I'd like to set a schedule run at the first day of each month, but the destination server requires constant password changes and they're the same used to access SAS servers.

 

Is there some way to pass the same SAS password in proc HTTP without writting it after each change?  

3 REPLIES 3
jimbarbour
Meteorite | Level 14

For the code that you have marked as "avoid," do you mean that you'd like to NOT code a password?  I don't blame you a bit.

 

So, in other words, you do NOT want to do this:

PROC HTTP
    URL='...'
    METHOD='get'
    Out=OutFIle
    WebUserName='Omiguelz' /* <--- Avoid */
    WebPassword='Secret_Password' /* <--- Avoid */
    ;
Run;

Where there are literal values in the code.  Am I understanding that correctly?  

 

One way to avoid that is to use macro variables.  Something like this:

PROC HTTP
    URL='...'
    METHOD='get'
    Out=OutFIle
    WebUserName="&User_ID"
    WebPassword="&Password"
    ;
Run;

The values of the macro variables could be set dynamically, for example in a Data step that knows which password to use which days.

 

In our system, we encrypt the passwords so that they are not plain text.  Instead they look like:

{SAS005}9956AC09F4F02674FEAE7CFE7FA91DF070E7DC1D64AA589D

 

Jim

OliveiraMiguelZ
Obsidian | Level 7
Thanks, Jimbarbour!

I think I haven't expressed myself as I wanted to.
I was looking for a way to use in WebUserName and WebPassword parameters the same values as my SAS Server credentials.

After post this I started to rethink my program and found another way to do it.

And, believing you're as curious as me, let me explain how I dealt with it. I used proc SQL "execute" statement with a connection directly to the database, so it's basically the same as asking the server a HTTP without passing the credentials (in my case, that there wasn't a complex proccess behind the report, sure)

Sajid01
Meteorite | Level 14

As long as your server is using NTLM or Kerberos as the authentication mechanism and your current user identity has permissions / access, you don't need passwords.

Needless to say that the user and the server you are connecting to are within the same domain i.e., you are within the company intranet.
Try proc http without username and password it should work.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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