Help using Base SAS procedures

Proc Http: trouble with using proxy ip address

Reply
Frequent Contributor
Posts: 92

Proc Http: trouble with using proxy ip address

Hello,

I want to download some data off the internet using a proxy ip address.  Can proc http do this?  I see there's a proxyhost parameter in the procedure, but I'm having trouble converting my proxy ip address into something that'll work.  I'm using 108.186.244.240 on port 3128.  When I specify proxyhost="108.186.244.240" & proxyport=3128, the code executes, but it doesn't use the proxy ip.  Note I'm able to use the proxy address in Chrome.  When I go to whatsmyip.org, it shows my hostname as 108.186.244.240.  There's no .com or anything else.  Also, I have a proxyuser and proxypass; Both of them are specified in my code.  

Has anyone run into similar issues using proxies with proc http?  If so, how did you solve your problems? 

Should I ditch proc http and use filename url + curl?  I've been having a fun Saturday night trying to get this to work, so any help would be extremely appreciated! 

Best,

Bill

Code:

filename in " C:\Users\Bill\SAS\Data\OPTIONS\in";

filename out " C:\Users\Bill\SAS\Data\OPTIONS\data_temp.txt";

%let x=&d; %let s=%superq(x);

%let a=&e; %let p=%superq(a);

data _null_;

   file in;

   input;

   put _infile_;

   datalines4;

;;;;

proc http

   in=in

   out=out

   url="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.option_contracts%20WHE..."

   method="post"

   ct="application/x-www-form-urlencoded"

   proxyhost="207.150.166.115"

   proxyusername="&proxyuser"

   proxypassword="&proxypass"

   proxyport=3128;

run; 

data temp;

infile out recfm=n dlm='<>';

length symbol expiration $ 20;

retain symbol;

input token : $1000. @@;

if prxmatch('/(^\d{4}-\d{2})|(option\s+symbol=)/o',token) then do;

  if left(token) =: 'option' then  do;symbol=scan(token,2,'"'); delete;end;

  expiration=token;

  output;

end;

drop token;

run;

Ask a Question
Discussion stats
  • 0 replies
  • 627 views
  • 0 likes
  • 1 in conversation