全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1389 6
2012-12-07
悬赏 100 个论坛币 已解决
I have the following data stored in a character variable Payment:

87.69/88.20/150.50//183.60195.8987.00/88.35//195.28/47.40/99.2260.34//20.45//325.00/96.45295.00/96.54  Which function should I use to count the number of payment per line to calculate the totalexpense?('/'separate the payment)

最佳答案

pobel 查看完整内容

data have; input payment : $80.; cards; 87.69/88.20/150.50//183.60 195.89 87.00/88.35//195.28/47.40/99.22 60.34//20.45//325.00/96.45 295.00/96.54 ; data want; set have; total_payment=0; i=1; tmp=input(scan(payment,i,"/"),best.); do while (^missing(tmp)); total_payment+tmp; i=i+1; tmp=input(scan(payment,i,"/"),best.); ...
二维码

扫码加我 拉你入群

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

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

全部回复
2012-12-7 10:30:50
data have;
   input payment : $80.;
   cards;
87.69/88.20/150.50//183.60
195.89
87.00/88.35//195.28/47.40/99.22
60.34//20.45//325.00/96.45
295.00/96.54
;

data want;
   set have;
   total_payment=0;
   i=1;
   tmp=input(scan(payment,i,"/"),best.);
   do while (^missing(tmp));
            total_payment+tmp;
            i=i+1;
            tmp=input(scan(payment,i,"/"),best.);
        end;
    N_payment=i-1;
    drop i tmp;
run;





二维码

扫码加我 拉你入群

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

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

2012-12-7 10:50:51
183.60195.8987.00,多个小数点的数字是什么?
二维码

扫码加我 拉你入群

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

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

2012-12-7 15:22:08
87.69/88.20/150.50//183.60
195.89
87.00/88.35//195.28/47.40/99.22
60.34//20.45//325.00/96.45
295.00/96.54

Which function should I use to count the number of payment per line and to calculate the total Payment?('/'separate the payment)
二维码

扫码加我 拉你入群

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

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

2012-12-7 15:22:54
I have the following data stored in a character variable Payment:

87.69/88.20/150.50//183.60
195.89
87.00/88.35//195.28/47.40/99.22
60.34//20.45//325.00/96.45
295.00/96.54

Which function should I use to count the number of payment per line and to calculate the total Payment?('/'separate the payment)
二维码

扫码加我 拉你入群

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

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

2012-12-7 15:26:45
data _null_;
test="87.69/88.20/150.50//183.60195.8987.00/88.35//195.28/47.40/99.2260.34//20.45//325.00/96.45295.00/96.54";
num=count(a,'/')+1;
put num=;
run;
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群