楼主: bourn
1011 0

请问如何用SAS提取网页数据呢? [推广有奖]

  • 2关注
  • 18粉丝

副教授

17%

还不是VIP/贵宾

-

威望
0
论坛币
1125 个
通用积分
0.4800
学术水平
9 点
热心指数
8 点
信用等级
5 点
经验
30894 点
帖子
421
精华
0
在线时间
1010 小时
注册时间
2009-10-3
最后登录
2021-8-14

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
由于工作需要,想提取网页中关于手机各项指标的数据。找到以下程序,但是运行不出来,请问是怎么回事呢?
程序转载至:http://saslist.com/elek/2010/09/15/%E9%80%9A%E8%BF%87-sas-%E8%AF%BB%E5%8F%96%E7%BD%91%E9%A1%B5%E5%86%85%E5%AE%B9/
  1. filename readweb url %nrstr("http://detail.zol.com.cn/cell_phone_index/subcate57_list_s528_1.html") lrecl=60000;

  2. data tmp;
  3.         infile readweb lrecl=60000 dlm="><";
  4.         retain flag 0;
  5.         length title1 $ 20;
  6.         if flag=0 then do;
  7.                 title="手机名称";
  8.                 input @'id="proName_' @'>' content :$50. @@;
  9.                 flag=1;
  10.                 num+1;
  11.                 if title="手机名称" then title1="name";
  12.                 output;
  13.         end;
  14.         input @'<dd class="tit_new">' title :$50. @;
  15.         if title="上市日期" then do;
  16.                 flag=0;
  17.         end;
  18.         input @'<dd class="con_new">' content :$50. @@;
  19.         if scan(content,1,"=")="a href" then input content :$50. @@;
  20.         if title="所属系列" then title1="series";
  21.         if title="操作系统" then title1="os";
  22.         if title="手机类型" then title1="type";
  23.         if title="网络模式" then title1="net";
  24.         if title="主屏尺寸" then title1="screen_size";
  25.         if title="主屏色彩" then title1="screen_color";
  26.         if title="触摸屏:" then title1="screen_type";
  27.         if title="摄像头像" then title1="camera";
  28.         if title="蓝牙功能" then title1="bluetooth";
  29.         if title="上市日期" then title1="date";
  30.         output;
  31.         drop flag;
  32. run;

  33. proc transpose data=tmp out=want(drop=_name_);
  34.         var content;
  35.         by num;
  36.         id title1;
  37. run;
复制代码
预期结果应该是:
Expected dataset.jpg




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:如何用 Bluetooth Transpose filename Content 网页 如何

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-3 04:40