2013年1月25日

【SAS NOTE】OUTPUT

摘要: 1 proc means data=mysas.ifthen11;2 var year date gtone shen dong all;3 output out=mysas.tryout max(gtone shen)=a b;4 run;5 proc print data=mysas.tryout;6 run;用output可以将means的结果另存到另一个数据集中。1 proc means data=mysas.ifthen11;2 var year date gtone shen dong all;3 by year;4 output o... 阅读全文

posted @ 2013-01-25 20:37 colipso 阅读(337) 评论(0) 推荐(0) 编辑

【SAS NOTE】MEANS

摘要: 1 data mysas.ifthen11;2 infile 'e:\ifthen.txt' firstobs=2;3 input date yymmn6. gtone shen dong all;4 year=year(date);5 run;6 proc means data=mysas.ifthen11 max min n nmiss sum range ;7 by year;8 where year(date)<=2011;9 run;means过程很适合统计月度或年度数据。在常规分析中会经常用到。其中by字句做归类,where 做筛选。 阅读全文

posted @ 2013-01-25 19:45 colipso 阅读(242) 评论(0) 推荐(0) 编辑

【SAS NOTES】_NULL_

摘要: Data _NULL_;........用于在数据步中执行操作,但不产生数据集。_NULL_ tells sas not to bother writing a sas data set,and makes the program run slightly faster. 阅读全文

posted @ 2013-01-25 19:04 colipso 阅读(365) 评论(0) 推荐(0) 编辑

【SAS NOTE】用file+put实现结果输出

摘要: 1 data mysas.ifthen10;2 infile 'e:\ifthen.txt' firstobs=2;3 input date yymmn6. gtone shen dong all;4 y=year(date);5 m=month(date);6 format date yymmn6.;7 file 'e:\output.txt' print;8 put y '年' m 'm,getong sms users number is' gtone;9 run; put的好处是可以直接根据变量生成文本结果报告。同时需要注 阅读全文

posted @ 2013-01-25 19:01 colipso 阅读(423) 评论(0) 推荐(0) 编辑

【SAS NOTES】print&format

摘要: proc print data=mysas.sort1; sum gtone shen dong all;run; 可以在print中增加sum选项来直接汇总值。【the little sas book】standard fromats in page 131. 1 data mysas.formatone; 2 infile 'e:\fromatesone.txt' firstobs=2; 3 input gender age; 4 proc format ; 5 value gendera 1='male' 6 2='female... 阅读全文

posted @ 2013-01-25 18:40 colipso 阅读(231) 评论(0) 推荐(0) 编辑

【SAS NOTE】where & time

摘要: 1 proc print data=mysas.ifthen8;2 format date yymmn6.;3 where year(date) < 2010 and month(date)<5;4 run;对时间的筛选处理建议使用year month等函数。在sort中用 Nodupkey DUPOUT=extraobs;可以用来删除重复项。 阅读全文

posted @ 2013-01-25 18:13 colipso 阅读(242) 评论(0) 推荐(0) 编辑

【SAS NOTES】$ / #

摘要: 对于data过程,文本类变量一定要加 $ 同一个observation跨行的话用/ 或#来连接。 阅读全文

posted @ 2013-01-25 13:55 colipso 阅读(285) 评论(0) 推荐(0) 编辑

导航