全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2468 7
2013-04-01
悬赏 1000 个论坛币 已解决
请问高手,我的数据及程序如下,我可以正常运行,并得到正常结果,但当我把程序中的数据换成2万个时(2万条记录时),每次运行sas,sas均会自行退出sas软件,请问高手,这是什么原因,我的sas是9.2版本,我的内存是3G。yongyitian认为,可能是我的内存太小,故他用另一个程序想来解决我的问题,程序如下(第二个程序),但没写完整,请问哪位高手可帮我写完整,并同时满足下列两个程序的目的。

data lyf;
  input  cardNo month  sex  age         a              b          c          d        e ;
cards;
2444280         7        1        0        0.00        0.00        1.00        1.00        0.00
2446235         9        0        2        0.00        1.00        1.00        1.00        0.00
2505588         11        0        2        0.00        1.00        1.00        1.00        0.00
1580671         11        0        7        0.00        1.00        1.00        1.00        0.00
2864011         7        1        0        0.00        1.00        1.00        1.00        0.00
2447958         12        0        2        0.00        1.00        1.00        1.00        1.00
2613911         1        1        11        0.00        1.00        1.00        1.00        0.00
2683412         2        1        9        0.00        1.00        1.00        1.00        0.00
2882260         6        0        3        0.00        0.00        1.00        1.00        0.00
2937645         12        0        7        0.00        0.00        1.00        1.00        0.00
2586392         8        1        1        0.00        1.00        1.00        1.00        0.00
2863120         7        0        0        0.00        1.00        1.00        1.00        1.00
2962785         5        0        3        0.00        1.00        1.00        1.00        0.00
2972399         5        0        1        0.00        1.00        1.00        1.00        0.00
1920654         7        0        5        0.00        1.00        1.00        1.00        0.00
2611203         6        1        1        0.00        0.00        1.00        1.00        0.00
2879363         6        0        8        0.00        0.00        1.00        1.00        0.00
1839313         8        0        6        0.00        1.00        1.00        1.00        0.00
2628286         9        1        1        0.00        1.00        1.00        1.00        0.00
2680824         5        0        7        0.00        1.00        1.00        1.00        1.00
2967252         9        1        1        0.00        1.00        1.00        1.00        0.00
1980146         8        0        0        0.00        0.00        1.00        1.00        0.00
2375808         9        0        0        0.00        1.00        1.00        1.00        1.00
2605119         9        1        1        0.00        1.00        1.00        1.00        0.00
;
run;
proc sql;
    select count(*) as m
        from lyf
        where b=0 and e=0;
quit;


select count(*) from table
where rownum<5000;

or where 5001 < rownum < 10000



最佳答案

yongyitian 查看完整内容

I tried rownum it does not work on my case. Also the count(*) should not be used with rownum condition. try this data test; input card months sex age a b c d e f g h i j; datalines; 2444280 7 1 0 1.00 0.00 7.40 0.00 1.25 1.00 20.50 1.00 40.00 0.00 2446235 9 0 2 1.01 0.00 7.79 1.00 1.44 1.00 31.20 1.00 49.80 0.00 2505588 11 0 2 1.01 0.00 7.59 1.00 1.36 1.00 22.70 1.0 ...
二维码

扫码加我 拉你入群

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

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

全部回复
2013-4-1 22:44:08
I tried rownum it does not work on my case. Also the count(*) should not be used with rownum condition.

try this

data test;
input card  months   sex    age  a  b  c   d  e  f  g  h  i  j;
datalines;
2444280  7 1 0 1.00 0.00 7.40 0.00 1.25 1.00 20.50 1.00 40.00 0.00
2446235  9 0 2 1.01 0.00 7.79 1.00 1.44 1.00 31.20 1.00 49.80 0.00
2505588  11 0 2 1.01 0.00 7.59 1.00 1.36 1.00 22.70 1.00 56.90 0.00
1580671  11 0 7 1.02 0.00 8.17 1.00 1.59 1.00 26.30 1.00 67.80 0.00
2864011  7 1 0 1.03 0.00 8.10 1.00 1.29 1.00 34.60 1.00 55.50 0.00
2447958  12 0 2 1.04 0.00 7.83 1.00 1.68 1.00 31.20 1.00 67.80 1.00
2613911  1 1 11 1.04 0.00 7.52 1.00 1.16 1.00 25.10 1.00 47.40 0.00
2683412  2 1 9 1.04 0.00 7.86 1.00 1.44 1.00 31.70 1.00 33.10 0.00
2882260  6 0 3 1.06 0.00 5.99 0.00 1.49 1.00 23.20 1.00 49.50 0.00
2937645  12 0 7 1.06 0.00 7.02 0.00 1.41 1.00 27.80 1.00 48.40 0.00
2586392  8 1 1 1.06 0.00 8.22 1.00 1.62 1.00 18.00 1.00 58.80 0.00
2863120  7 0 0 1.06 0.00 7.69 1.00 1.28 1.00 21.00 1.00 58.30 1.00
2962785  5 0 3 1.06 0.00 7.60 1.00 1.36 1.00 20.70 1.00 53.60 0.00
2972399  5 0 1 1.06 0.00 8.51 1.00 1.41 1.00 28.80 1.00 45.50 0.00
1920654  7 0 5 1.07 0.00 7.69 1.00 1.21 1.00 20.50 1.00 68.30 0.00
2611203  6 1 1 1.08 0.00 7.34 0.00 1.36 1.00 27.80 1.00 58.30 0.00
2879363  6 0 8 1.08 0.00 6.12 0.00 1.42 1.00 15.60 1.00 48.40 0.00
1839313  8 0 6 1.08 0.00 7.65 1.00 1.21 1.00 16.60 1.00 67.30 0.00
2628286  9 1 1 1.08 0.00 7.66 1.00 1.20 1.00 16.60 1.00 58.80 0.00
2680824  5 0 7 1.08 0.00 7.87 1.00 1.29 1.00 20.00 1.00 82.50 1.00
2967252  9 1 1 1.08 0.00 7.74 1.00 1.39 1.00 27.10 1.00 49.80 0.00
1980146  8 0 0 1.09 0.00 6.68 0.00 1.22 1.00 17.60 1.00 53.20 0.00
2375808  9 0 0 1.09 0.00 8.54 1.00 1.41 1.00 20.50 1.00 80.10 1.00
2605119  9 1 1 1.09 0.00 7.62 1.00 1.20 1.00 18.00 1.00 61.60 0.00
2627601  4 0 0 1.09 0.00 7.62 1.00 1.15 1.00 15.60 1.00 54.10 0.00
2864551  7 0 5 1.09 0.00 8.35 1.00 1.39 1.00 23.20 1.00 78.90 1.00
3063115  9 0 10 1.09 0.00 7.98 1.00 1.46 1.00 22.90 1.00 74.90 0.00
2589025  5 1 0 1.10 0.00 7.06 0.00 1.26 1.00 22.00 1.00 45.30 0.00
;

proc sql ;
    select *
        from test (firstobs = 2 obs = 4); /* This is limit number of rows you retrive. You can also use other where conditions.  */
quit;
二维码

扫码加我 拉你入群

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

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

2013-4-1 23:31:43
先谢谢yongyitian!我去试一下!
二维码

扫码加我 拉你入群

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

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

2013-4-2 00:21:39
我知道yongyitian的答案不是完美答案,但是我首先要谢谢他的热心!
二维码

扫码加我 拉你入群

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

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

2013-4-2 00:22:48
我将设置另一个同样内容的悬赏贴,希望高手再次指导!谢谢大家!!链接如下:
请问sas是否对运行数据的数量有设置要求
https://bbs.pinggu.org/forum.php?mod=viewthread&tid=2313906&from^^uid=2090664

二维码

扫码加我 拉你入群

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

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

2013-4-2 00:23:29
我用的是SAS 9.3,运行了你的程序,没问题。Log文件如下:
31   proc sql;
32       select count(*) as m
33           from lyf
34           where b=0 and e=0;
NOTE: Writing HTML Body file: sashtml.htm
35   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.10 seconds
      cpu time            0.28 seconds

所以,会不会是ODS方面的问题。

如果你仅仅是要看一下m的值,为什么不用SQL create一个table呢?
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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