gpt4 book ai didi

sas - 如何在SAS中提取字符串的最后4个字符

转载 作者:行者123 更新时间:2023-12-04 18:05:57 25 4
gpt4 key购买 nike

改进了格式,当我写:-

indikan=substr(Indikation,length(Indikation)-3,4);

它给出了无效的论点。
这该怎么做?

最佳答案

此代码有效:

data temp;
indikation = "Idontknow";
run;

data temp;
set temp;
indikan = substrn(indikation,max(1,length(indikation)-3),4);
run;

你能提供更多关于变量的上下文吗?如果指示长度为 3 或更小,我可以看到此错误,或者如果它是数字,则可能会导致问题,因为它正确地证明了数字( http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245907.htm )。

关于sas - 如何在SAS中提取字符串的最后4个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27859183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com