Hi All,
I am trying to learn how to execute an api call on sas 9.3 using an example from below document .
But am getting the below error .
when I checked online for the error , I am getting the resolution as changing the config file
C:\SAS\Lev1\SASApp\sasv9.cfg ...
is there another mothod to excute this proc http .
Thanks in advance.
https://www.lexjansen.com/mwsug/2012/S1/MWSUG-2012-S110.pdf
%macro sas_getDist;
data _null_;
length url $ 2048;
url = catt(
'http://maps.googleapis.com/maps/api/directions/xml?origin=', &start,
'&destination=', &end,
'&sensor=false&alternatives=false');
url = translate(trim(url), '+', ' ');
call symputx('REQUEST_URL', url);
run;
FILENAME dist "\\Desktop\SAS\RESPONSE1.txt";
proc http
out = dist
url = "%superq(REQUEST_URL)"
method = "GET"
ct = "application/x-www-form-urlencoded";
run;
filename xml_map "\\Desktop\SAS\google-maps-dist.map";
libname dist xml xmlmap=xml_map;
data _null_;
set dist.distance;
/* 1 mile = 1,609.344 meters */
dist = dist / 1609.344;
call symputx('DIST', dist);
run;
%mend;
proc fcmp outlib=sasuser.funcs.web;
function sas_getDist(start $, end $);
rc = run_macro('sas_getDist', start, end, dist);
return (dist);
endsub;
quit;
data addresses;
length name $ 32 address $ 128;
infile datalines truncover;
input name address $128.;
datalines;
SAS SAS Campus Dr., Cary, NC 27513
YMCA 1603 Hillsborough St., Raleigh, NC 27605
NCSU Joyner Visitor Center, NC State University, Raleigh, NC 27695-7504
UNC-CH UNC Visitor Center, 250 East Franklin Street, Chapel Hill, NC
;
options cmplib=sasuser.funcs;
data distances;
set addresses;
dist = sas_getDist('SAS Campus Dr., Cary, NC, 27513', address);
run;
proc print data=addresses;
where sas_getDist('SAS Campus Dr., Cary, NC, 27513', address) < 10;
run;
ERROR:
59 proc fcmp outlib=sasuser.funcs.web;
60 function sas_getDist(start $, end $);
61 rc = run_macro('sas_getDist', start, end, dist);
62 return (dist);
63 endsub;
64 quit;
ERROR: Write access to member SASUSER.FUNCS.DATA is denied.
WARNING: Failed to save function sas_getDist to sasuser.funcs.web.
ERROR 2
--------------
WARNING: No CMP or C functions found in library sasuser.funcs.
79 dist = sas_getDist('SAS Campus Dr., Cary, NC, 27513', address);
___________
68
ERROR 68-185: The function SAS_GETDIST is unknown, or cannot be accessed.
... View more