SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 663|回复: 3
打印 上一主题 下一主题

新手问题

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2009-5-5 16:49:25 | 只看该作者

新手问题

一个函数问题
s='ABC.123 _xyZ_';
notupper(s,-4) → 4
为什么最后的结果是4,请好心人说明下search字符的顺序
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2009-5-6 17:30:53 | 只看该作者

Re: 新手问题

编程有问题
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
板凳
 楼主| 发表于 2009-5-6 17:49:16 | 只看该作者

Re: 新手问题

查help,描述:
The NOTUPPER function searches a string for the first occurrence of a character that is not an uppercase letter. If such a character is found, NOTUPPER returns the position in the string of that character. If no such character is found, NOTUPPER returns a value of 0.
The direction in which to search is determined in the following way:

If the value of start is positive, the search proceeds to the right.

If the value of start is negative, the search proceeds to the left.

If the value of start is less than the negative length of the string, the search begins at the end of the string.
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
地板
 楼主| 发表于 2009-5-22 05:04:27 | 只看该作者

Re: 新手问题

结果应该是4。

notupper功能:“Searches a character string for a character that is not an uppercase letter and returns the first position at which that character is found ”
-4:从第四位开始向左查。发现第四位为“.”,不是大写的,所以返回值为4。

如果notupper(s,-12),从第12位向左查,发现第12位为“Z”,是大写的,则继续往左查,发现第11位为“y”,不是大写,返回值11。

以上经过sas9.1测试过。
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2026-2-5 17:42 , Processed in 0.134837 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表