全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1908 5
2010-09-28
@有关书籍上说明执行下一个INPUT语句指针移到下一记录行,要求一条记录必须对应一个数据行,但是下列程序中的@让我很疑惑,请高手指点一二.
       data bb;
          input id dbp @;
          no=1; if dbp>0 then output;
          input dbp @;
          no=2; if dbp>0 then output;
          input dbp @;
          no=3; if dbp>0 then output;
          input dbp ;
          no=4; if dbp>0 then output;
        cards;
        1 70 75 86 80
        2 85 82 86 84
        3 74 52 80 62
        4 90  . 62 72
        5 75 80  . 75
;

按照书上解释,执行完1 和70 的输入后,指针会移到下一行也就是2 85 82....的开头,但是次程序继续输入75,处理,86,处理,让我有点疑惑.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2010-9-28 13:29:34
@换行符
因为只有两个变量
所以当指针读到第二个数的时候
就直接换在第二行继续读
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-9-28 13:31:31
看看PDV里面的一些指针如何运行的文章
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-9-28 15:42:40
谢谢老大,问题解决了,你回答的几乎完美.我刚翻阅了PDV指针参考.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-9-29 09:32:16
郑小知 发表于 2010-9-28 13:20
@有关书籍上说明执行下一个INPUT语句指针移到下一记录行,要求一条记录必须对应一个数据行,但是下列程序中的@让我很疑惑,请高手指点一二.
       data bb;
          input id dbp @;
          no=1; if dbp>0 then output;
          input dbp @;
          no=2; if dbp>0 then output;
          input dbp @;
          no=3; if dbp>0 then output;
          input dbp ;
          no=4; if dbp>0 then output;
        cards;
        1 70 75 86 80
        2 85 82 86 84
        3 74 52 80 62
        4 90  . 62 72
        5 75 80  . 75
;

按照书上解释,执行完1 和70 的输入后,指针会移到下一行也就是2 85 82....的开头,但是次程序继续输入75,处理,86,处理,让我有点疑惑.
It is a line-hold. Here is the meaning.

Use a trailing @ at the end of the INPUT statement to hold the record in the input buffer for the execution of the next INPUT statement.


A simplified version would be,


      data bb;

          input id     @;
          do no=1 to 4;
            input dbp @;
            if dbp>0 then output;
          end;

        cards;
        1 70 75 86 80
        2 85 82 86 84
        3 74 52 80 62
        4 90  . 62 72
        5 75 80  . 75
;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-10-4 22:49:18
5# bobguy
非常感谢副教授!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群