楼主: LWN.
757 4

[实际应用] 怎么将8.02 x 10^4 变成 80200 的数值型 [推广有奖]

  • 0关注
  • 0粉丝

本科生

19%

还不是VIP/贵宾

-

威望
0
论坛币
1248 个
通用积分
0
学术水平
1 点
热心指数
2 点
信用等级
0 点
经验
1118 点
帖子
13
精华
0
在线时间
136 小时
注册时间
2016-6-8
最后登录
2022-5-21

5论坛币
QQ截图20170326192540.png
怎么将图片中带有“x”的改为可以计算的数值型,比如将8.02 x 10^4 变成 80200 的数值型

最佳答案

wwang111 查看完整内容

data test; input hbvdna $20.; cards; 8.02×10^4 1.82×10^5
关键词:数值型 图片
沙发
wwang111 发表于 2017-3-26 19:30:13 |只看作者 |坛友微信交流群
data test;
input hbvdna $20.;
cards;
8.02×10^4
1.82×10^5
<500
;

data _null_;
  set test end=last;
  hbvdna=tranwrd(hbvdna,"×","*");
  hbvdna=tranwrd(hbvdna,"^","**");
  if _n_=1 then call execute("data wanted;");
  if index(hbvdna,"*") then call execute("hbvdna="||quote(strip(hbvdna))||';num_hbvdna='||strip(hbvdna)||';output;');
  else call execute("hbvdna="||quote(strip(hbvdna))||';num_hbvdna=.;output;');
  if last then call execute("run;");
run;

使用道具

藤椅
LWN. 发表于 2017-3-27 12:07:48 |只看作者 |坛友微信交流群
wwang111 发表于 2017-3-26 19:30
data test;
input hbvdna $20.;
cards;
厉害

使用道具

板凳
lovexialulu 发表于 2017-3-27 16:59:10 |只看作者 |坛友微信交流群
data a;
input x $20.;
cards;
8.02×10^4
1.82×10^5
<500

1.8232×10^7
;
run;

data b;
set a;
if index(x,'×') and index(x,'^') then do;
   a=input(scan(x,1,'×'),best.);
   b=10**input(scan(x,2,'^'),best.);
   c=a*b;
end;
run;

使用道具

报纸
LWN. 发表于 2017-3-27 20:39:23 |只看作者 |坛友微信交流群
lovexialulu 发表于 2017-3-27 16:59
data a;
input x $20.;
cards;
你这个更简便

使用道具

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

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

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

GMT+8, 2024-4-25 18:14