如何从选定的短语中汇总数字? (SAS,SQL)
我想从下面的文本中总结数字:
Kwota=237 + Kwota=30.87 + Kwota=292.74 + Kwota=292.74 + Kwota=300.87
即:
kwota = 1154,22
在示例中有5个短语,但它们的数字可能会有所不同。
文字:
[Forma sprzedazy=leasing, auto: Audi A 6, Kwota=237, Cena =123],[Forma sprzedazy=leasing, auto: Volvo, Kwota=30.87, Cena =10],[Forma sprzedazy=leasing, auto: VW Golf, Kwota=292.74, Cena =134],[Forma sprzedazy=leasing, auto: VW Golf, Kwota=292.74, Cena =134],[Forma sprzedazy=leasing, auto: Porche, Kwota=300.87, Cena =152]
I would like to sum up the numbers from the text below:
Kwota=237 + Kwota=30.87 + Kwota=292.74 + Kwota=292.74 + Kwota=300.87
that is:
Kwota=1154,22
In the example there are 5 phrases but their number may vary.
text:
[Forma sprzedazy=leasing, auto: Audi A 6, Kwota=237, Cena =123],[Forma sprzedazy=leasing, auto: Volvo, Kwota=30.87, Cena =10],[Forma sprzedazy=leasing, auto: VW Golf, Kwota=292.74, Cena =134],[Forma sprzedazy=leasing, auto: VW Golf, Kwota=292.74, Cena =134],[Forma sprzedazy=leasing, auto: Porche, Kwota=300.87, Cena =152]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您可以使用perl正则表达式查找
kwota =< number>
零件,使用匹配组提取数字文本,input> input
将文本转换为数字可以以总和或总变量积累。示例:
另外,如果您直接从文本文件中读取,则可以使用基于字符的列指针控制的输入语句,例如
You can use Perl regular expressions to find the
kwota=<number>
pieces, extract the number text using a matching group, andinput
function to convert the text to a number that can be accumulated in a sum or total variable.Example:
Alternatively, if you are reading from a text file directly, you could use an INPUT statement with character based column pointer control such as