p***7 发帖数: 535 | 1 xyz='She sells seashells? Yes, she does.';
startposexp=1-23;
whereisShe_ineg22=find(xyz,'She','i',startposexp);
put whereisShe_ineg22;
what is the return position?
the answer is 14
Can anyone tell me how 14 is resulted? I am confused about 'startposexp=1-23
;'
I am learning SAS by myself, it is hard for me to understand some concepts
Thanks so much! | k*******a 发帖数: 772 | 2 startposexp=1-23
说明他是 -22
负数表示从倒数第一个往前数22个 | p***7 发帖数: 535 | 3 Thanks!
Does a startpos has an effect on returns?
please see the example below
xyz='She sells seashells? Yes, she does.';
startposvar=22;
whereisshe_22=find(xyz,'she',startposvar);
put whereisshe_22;
the answer is 27
which is as same as the one without startpos here
whereisshe=find('She sells seashells? Yes, she does.','she ');
put whereisshe;
they are both 27
t | k*******a 发帖数: 772 | 4 应该有关系
你这里从第22个开始找,前面那个是从-22((也就是大概十一二的样子)开始找,起始
位置不同,返回自然也不同
【在 p***7 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Thanks! : Does a startpos has an effect on returns? : please see the example below : xyz='She sells seashells? Yes, she does.'; : startposvar=22; : whereisshe_22=find(xyz,'she',startposvar); : put whereisshe_22; : the answer is 27 : which is as same as the one without startpos here : whereisshe=find('She sells seashells? Yes, she does.','she ');
| p***7 发帖数: 535 | 5 if startpos have an effect, the below program should be 5
xyz='She sells seashells? Yes, she does.';
But the answer is 27, which does not make any sense. |
|