我正在尝试访问网址,并希望将数据存储到数据集中,并将输出文件存储为JSON ..
我只想获取URL数据并存储为JSON文件 但我的问题有两部分......
file
命令和put
扩展名为json
html tags
然后可以通过SAS json
格式
醇>
我试图提取假设http://www.google.com或http://headers.jsontest.com ....这是我的代码......
LIBNAME src '/home/user/readURL';
filename test_url url 'http://headers.jsontest.com' debug lrecl=8192;
data src.http;
infile test_url length=len;
input record $varying8192. len;
file '/home/user/readURL/READ_URL.txt';
put test_url;
run;
proc print data = src.http;
run;
这是我执行代码后收到错误消息的日志文件:错误:连接已超时..
任何想法如何摆脱这个......
2 The SAS System 07:57 Wednesday, January 15, 2014
16 filename test_url url 'http://headers.jsontest.com' debug lrecl=8192;
17 data src.http;
18 infile test_url length=len;
19 input record $varying8192. len;
20 run;
ERROR: The connection has timed out..
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements. This may cause NOTE: No observations in data set.
WARNING: The data set SRC.HTTP may be incomplete. When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set SRC.HTTP was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 1:14.92
cpu time 0.03 seconds
并将READ_URL.txt
作为空白文件
感谢您提前提供任何帮助......
答案 0 :(得分:1)
其实我已经解决了我自己的问题,但只有第一部分....如果有人发现这种类似的错误(错误:连接超时.. )...尝试使用那边是proxy
....就像我在我的代码中添加了....
LIBNAME src '/home/user/readURL';
filename test_url url 'http://headers.jsontest.com' debug lrecl=8192 PROXY='http://hostname:portno/';
data src.http;
infile test_url length=len;
input record $varying8192. len;
file '/home/user/readURL/READ_URL.json';
put record;
run;
proc print data = src.http;
run;
但我仍然需要解决我的第二部分问题......