楼主: oxygenmz
5339 19

谁有正版SAS, 帮我run 一下啊~~谢谢! FIND FUNCTION [推广有奖]

11
oxygenmz 发表于 2009-10-31 00:51:58
收到! 万分感谢

12
jxz018 发表于 2009-10-31 01:28:10
The following is what I got. My SAS version is 9.2.

NOTE: Copyright (c) 2002-2008 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.2 (TS2M0)
      Licensed to U OF AR - FAYETTEVILLE CAMPUS - T&R, Site 70007032.
NOTE: This session is executing on the XP_PRO  platform.



NOTE: SAS initialization used:
      real time           0.45 seconds
      cpu time            0.31 seconds


NOTE: AUTOEXEC processing beginning; file is C:\Program Files\SAS\SASFoundation\9.2\autoexec.sas.

NOTE: Libref TEMPAREA was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\Temp
NOTE: Libref CURRENT was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\DOCUMENTS AND SETTINGS\JXZ018\MY DOCUMENTS\RESEARCH BOOK\SAS CLASS

NOTE: AUTOEXEC processing completed.

1          data find;
2          text='DELIMIT IT WITH BLANKS.';
3          Pos4=find(Text,'with','I',5);
4          Pos3=find(Text,'el','I', -16);
5          run;

NOTE: The data set WORK.FIND has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.00 seconds


NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
      real time           0.59 seconds
      cpu time            0.34 seconds

13
yuyyy 发表于 2009-10-31 02:10:41
觉得比较搞 从左往右时得设得值大概是忽略之前得值进行 但搜索还是从最左开始 就是如果with在前4个字符得话 结果还是12
但是负值得话 搞不懂了 看了个例子 s1=“Hello hello goodbye" s2=”hello''    find(s1, s2, ''i'', -99) 的值是7
说是如果负值的长度大于string长度就从最右从左开始搜索 可是数起来不对 即使是从左往右的话 值应该是1
哪位高人指点下下?

14
jingju11 发表于 2009-10-31 02:17:45
13# yuyyy

因为99要比字符串的长度大,而且是负号,所以从最右端开始向左找。先找到的是第二个‘HELLO',它是从位置7开始的。所以值是7

15
yuyyy 发表于 2009-10-31 02:30:36
那就是find结果都是从左开始算起来的 无论从哪个方向

16
oxygenmz 发表于 2009-10-31 03:03:52
对,所指的position,都是从左边开始数起的。
你举了个非常好的例子,谢谢。终于搞明白了。

17
jingju11 发表于 2009-10-31 03:47:44
想一想,如果同一个东西的标志, 这里指的是所寻找的字符(串)的位置,都不固定的话,还怎么用?另外也未必要扣得这么细吧,find 的作用是什么?你未必想知道你要找的东西在哪个具体的位置上,而是要确定其中有没有。正反左右就由他去吧,不是吗?

18
maybelleluan 发表于 2009-10-31 10:10:25
一群热心人啊

19
coolgaly 发表于 2009-10-31 10:36:41
data find;

2    text='DELIMIT IT WITH BLANKS.';

NOTE: SCL source line.

3    Pos4=find(Text,'with','I',5);

          ----

          68

NOTE: SCL source line.

4    Pos3=find(Text,'el','I', -16);

          ----

          68

ERROR 68-185: The function FIND is unknown, or cannot be accessed.



5    run;



NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.FIND may be incomplete.  When this step was stopped there were 0

         observations and 3 variables.

NOTE: DATA statement used:

      real time           4.26 seconds

      cpu time            0.06 seconds
text='DELIMIT IT WITH BLANKS.';
14   Pos4=find(Text,'with','I',5);
15   Pos3=find(Text,'el','I', -16);
16   put pos4 pos3;
17   run;

12 2
NOTE: 数据集 WORK.FIND 有 1 个观测和 3 个变量。
NOTE: “DATA 语句”所用时间(总处理时间):
      实际时间         0.00 秒
      CPU 时间         0.00 秒
奋斗不息

20
HHHomer 在职认证  发表于 2009-10-31 16:43:44
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)
      Licensed to ICFAI BUSINESS SCHOOL, Site 0049647001.
NOTE: This session is executing on the XP_PRO  platform.



NOTE: SAS initialization used:
      real time           0.85 seconds
      cpu time            0.56 seconds

1    data find;
2    text='DELIMIT IT WITH BLANKS.';
3    Pos4=find(Text,'with','I',5);
4    Pos3=find(Text,'el','I', -16);
5    run;

NOTE: The data set WORK.FIND has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.01 seconds

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-24 21:24