02 2013 档案

【sas proc sql】汇总数据
摘要:In the following conditions:the select clause references a column that contains an aggregate function that is not listed in a group by clause.the select clause references a column that contains an aggregate function and other column or columns that are not listed in the group by clause.one or more c 阅读全文

posted @ 2013-02-27 16:58 colipso 阅读(463) 评论(0) 推荐(0) 编辑

【sas sql proc】统计
摘要:类似于sql标准语句,在proc sql 中可以对列进行统计,前提是要有group by 或having字句。avg mean count freq n css cv max min nmiss prt range std stderr sum sumwgt t uss var1 proc sql outobs=10;2 select distinct subporduct_code,mean(cmcc_fee,down_fee) as avgfee 3 from &dataset4 where calculated avgfee>10;5 quit;可以将计算生成的变... 阅读全文

posted @ 2013-02-27 16:31 colipso 阅读(427) 评论(0) 推荐(0) 编辑

【R】书籍推荐
摘要:from:http://xccds1977.blogspot.com/2013/02/r.htmlhttp://www.1point3acres.com/bbs/thread-51301-1-1.html以前人的烦恼是没有书可读,现在人的烦恼是书太多了。关于R语言的书已经出版很多了,博主大约读过其中的四十多本,但是书在精,而不在多,学在透,而不在速。把有限的时间放到无限的书海中,这不是阅读的真意。本着造福学习者的角度,博主精选出十二本R书。什么是好书的标准?我以为是:有案例,有代码,有习题,有讲解,逻辑清楚,排版精良,体系完备,互有补充,内容千锤百炼,值得反复揣摩。书单均为英文版,都可以从网上 阅读全文

posted @ 2013-02-22 17:07 colipso 阅读(747) 评论(0) 推荐(0) 编辑

【摄影】延时摄影
摘要:fromhttp://highvoltage.tuchong.com/2192920/1.前期准备:器材:定时快门线(推荐永诺MC-36b,注意相应机身型号)、三脚架、滤镜(依情况而定)。机身镜头自备,存储卡最好在8G以上,4G也可以。软件:Photoshop、会声会影X4(Corel VideoStudio Pro X4)。VeryCD上可以下载到。最好用X4版,里面有导入延时图像序列功能。 2.拍摄方法:(1)机身设置:*M档,ISO手动。注:除特殊情况,拍地铁那一段因为场景单一(不影响测光系统),光线变化较大,所以我使用自动ISO200—ISO1600*白平衡手动,可以用预设,也可以手动 阅读全文

posted @ 2013-02-22 14:03 colipso 阅读(404) 评论(0) 推荐(0) 编辑

【分析模板】excel or sas
摘要:虽然已经有一个excel的常规分析模板:原始数据--》抽取并运算指标数据--》生成图形。但弊端是excel是基于表格位置的处理,某些绝对引用公式,是不会随着插入或删除行列而改变。原始数据或汇总数据结构更改时整个分析模板的更改量就非常巨大。最近在思考用sas来重新搭建这个模板,思路是:原始数据(txt or xls)--》sas读入原始数据(定期添加最新值)--》处理生成指标数据(放入另一个库)--》处理生成图形底层数据并写入固定excel的固定位置--》excel生成图形。这样在原始数据表结构更改的时候基于变量处理的sas程序不会受到影响。而且也易于修改和重新生成。有空的时候用某个业务来做一个 阅读全文

posted @ 2013-02-22 09:31 colipso 阅读(394) 评论(0) 推荐(0) 编辑

【SAS proc sql】选择字段可添加的参数
摘要:1 proc sql outobs=5;2 select date label='time',wangnei fromat=comma3.3 from mysas.mms;4 quit;对于select的字段可以添加参数,包括:format informat label length. 注意proc sql 的限制显示个数为outobs 和proc print (obs) 不同。 阅读全文

posted @ 2013-02-21 21:01 colipso 阅读(1252) 评论(0) 推荐(0) 编辑

【SAS proc sql】对缺失值的处理
摘要:1 proc sql;2 select date,coalesce(city,1),wangnei from mysas.mms;3 quit;coalesce()函数可以判断字段的缺失值并用指定的值来代替,注意字段值类型需要和指定的值类型保持一致。或者1 proc sql;2 select date,wangnei,3 case4 when city is missing then 15 else city6 end as city7 from mysas.mms;8 quit;也可以实现... 阅读全文

posted @ 2013-02-21 20:55 colipso 阅读(4472) 评论(0) 推荐(0) 编辑

【sas note】实践
摘要:1 data guanhui.usergroup1; 2 set guanhui.usergroup; 3 fee1=fee; 4 run; 5 proc format; 6 value freqgroup 7 low-5='1~5' 8 6-10='5~10' 9 11-20='10~20'10 21-40='21-40'11 41-high='>40';12 run;13 proc format;14 value feegroup15 low-100='1~100'16 101-200=& 阅读全文

posted @ 2013-02-20 17:06 colipso 阅读(274) 评论(0) 推荐(0) 编辑

【sas notes】proc cluster
摘要:用CLUSTER过程和TREE过程进行谱系聚类一、CLUSTER过程用法CLUSTER过程的一般格式为:PROC CLUSTER DATA=输入数据集METHOD=聚类方法 选项:VAR 聚类用变量:COPY 复制变量:RUN;其中的VAR语句指定用来聚类的变量。COPY语句把指定的变量复制到OUTTREE=的数据集中。PROC CLUSTER语句的主要选项有:·METHOD=选项,这是必须指定的,此选项决定我们要用的聚类方法,主要由类间距离定义决定。方法有AVERAGE,CENTROID,COMPLETE, SINGLE, DENSITY, WARD, EML, FLEXIBLE, 阅读全文

posted @ 2013-02-20 14:07 colipso 阅读(1435) 评论(0) 推荐(0) 编辑

【sas proc sql】distinct
摘要:在两数据集匹配的时候加上distinct可以避免重复数据的出现proc sql; create table guanhui.loyaluser as select distinct a.serv_number,pay_way,fee from guanhui.buedetail_same a,guanhui.loyalusernumber b where a.serv_number=b.serv_number;quit; 阅读全文

posted @ 2013-02-19 14:07 colipso 阅读(1294) 评论(0) 推荐(0) 编辑

【sas sql proc】case end
摘要:在sql中增加case可以增加数据处理的灵活性,注意结尾的end 1 proc sql outobs=10; 2 title 'this is an example of sql and case'; 3 select wangnei,date, 4 case 5 when 200901<=date<=200903 then 'first' 6 when 200904<=date<=200906 then 'second' 7 else 'else' 8 en... 阅读全文

posted @ 2013-02-18 22:14 colipso 阅读(2066) 评论(0) 推荐(0) 编辑

【sas proc sql】引用计算产生的列
摘要:在proc sql中引用计算产生的列,前面必须加上calculated例如1 proc sql outobs=5;2 title 'this is an example of sql and outobs';3 select wangnei,date,'test','测试',wangnei+1 as wang,wangnei+10 as wanga,(calculated wang+calculated wanga) as wangb4 from mysas.mmsone5 where date<2009056 order by wangn 阅读全文

posted @ 2013-02-18 22:02 colipso 阅读(698) 评论(0) 推荐(0) 编辑

【sas sql proc】proc sql; quit;
摘要:proc sql 是以quit结束,而非run 1 proc print data=mysas.mmsone (obs=10); 2 run; 3 proc sql; 4 title 'this is an example of proc sql'; 5 select sum(wangnei) as a,date 6 from mysas.mmsone 7 where date<200904 8 group by date 9 having date in(200901,200902)10 order by a desc;11 quit;... 阅读全文

posted @ 2013-02-18 21:22 colipso 阅读(1312) 评论(0) 推荐(0) 编辑

【SAS NOTE】实践
摘要:1 proc format; 2 value numgroup 3 low-10='1~10' 4 11-50='10~50' 5 51-100='50~100' 6 101-500='100-500' 7 500-high='>500'; 8 run; 9 ods html file="E:\11月统计.xls";10 proc means data=guanhui.visit_ip_num (where=(month=11)) n;11 var number;12 class numb 阅读全文

posted @ 2013-02-18 11:43 colipso 阅读(237) 评论(0) 推荐(0) 编辑

【SAS NOTES】学习路径
摘要:转载:http://blog.csdn.net/utnewbear/article/details/8258278SAS的强大毋庸置疑,要精通SAS必先要熟悉其结构及不断提高自己的编程能力(虽然它有菜单可以用,其实一般都不用,写程序比菜单灵活多了,而且效率高多了,工作中都以编程为主。所以想点点鼠标就能精通SAS的同学就要想清楚了)。大家可别把SAS跟一般的高级语言相比,相信不少同学学过C,Java等等,虽然SAS也具有一般高级语言的特征(如:条件,循环,模块化,甚至面向对象等等),但是别以为你精通编程就能精通SAS。在学SAS之前,大家要记住,SAS是market-oriented。SAS不是 阅读全文

posted @ 2013-02-17 23:16 colipso 阅读(1159) 评论(0) 推荐(1) 编辑

【SAS NOTES】数据输出-proc export
摘要:数据输出可以使用files->export data 菜单,注意:1.输出路径需要全英文,不能包含中文。2.对输出过程的语句可以在菜单的最后一步存储下来。1 proc export data=mysas.mms outfile='f:\b.txt' dbms=dlm replace;2 delimiter='^';3 run;delimiter分隔符的设置是优先执行的。dbms用来指定文件类型,sas也可以从生成文件的扩展名中判断。可以使用的扩展名有xls dbf jmp wk4 db sav dta对于excel可以使用sheet='*****& 阅读全文

posted @ 2013-02-17 21:48 colipso 阅读(3488) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc anova分类变量对比方差分析
摘要:1 ods graphics on;2 proc anova data=mysas.mmsone;3 class city;4 model wangnei=city;5 means city/t;6 run;方差分析用于多个类别之间的显著性检验。means的t检验可以用于对类别分群。 阅读全文

posted @ 2013-02-15 10:54 colipso 阅读(1747) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc reg 单变量线性回归
摘要:1 ods graphics on;2 proc reg data=mysas.mmstwo plots=fitplot;3 model wangjian=wangnei;4 run;对于可显示的图形有多种,可参考sas帮助。 阅读全文

posted @ 2013-02-15 10:35 colipso 阅读(968) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc corr 检验变量相关性
摘要:1 ods graphics on;2 proc corr data=mysas.mmstwo plots=(scatter matrix);3 var wangnei;4 with wangjian;5 run;The SAS System 17:32 Saturday, February 14, 2009 39The CORR Procedure 1 With Variables: wangjian 1 Variables: wangnei ... 阅读全文

posted @ 2013-02-14 22:50 colipso 阅读(3448) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc freq 检验两分类变量
摘要:1 proc freq data=mysas.mmstwo;2 tables wangnei*wangjian;3 run;可增加图形的完整类型为:odc graphics on;proc freq data=****; tables variable*variable /options plots=*****;run;options contain agree chisq cl cmh exact measures plcorr relrisk trendplot contain cumfreqplot deviationplot freqplot kappaplot oddsrt... 阅读全文

posted @ 2013-02-14 22:34 colipso 阅读(1307) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc means 指定检验类型
摘要:1 proc means data=mysas.mmstwo n t p99 range;2 var wangnei;3 run;统计类型包括:clm css cv kurtosis lclm max mean min mode n nmiss等等等等等等可以用alpha=.10 来设置 置信水平:proc means data=**** alpha=.01 n clm; 阅读全文

posted @ 2013-02-14 22:19 colipso 阅读(485) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc univariate检查单变量分布
摘要:1 proc univariate data=mysas.mmstwo;2 var wangnei;3 run;结果The SAS System 17:32 Saturday, February 14, 2009 1 The UNIVARIATE Procedure Variable: wangnei Moments ... 阅读全文

posted @ 2013-02-14 20:05 colipso 阅读(1641) 评论(0) 推荐(0) 编辑

【sas notes】proc sgplot拟合曲线
摘要:1 proc sgplot data=mysas.mmstwo;2 reg x=date y=wangnei;3 loess x=date y=wangnei;4 pbspline x=date y=wangnei;5 run;其中每个回归类型可选的参数有clm group nolegclm nolegfit nomarkers 阅读全文

posted @ 2013-02-13 13:45 colipso 阅读(1653) 评论(0) 推荐(0) 编辑

【sas notes】proc sgplot折线图
摘要:1 proc sgplot data=mysas.reportmms;2 series x=date y=wangnei_max/group=city;3 refline 5000000 6000000/axis=y;4 run;其中refline可以用来标出参考线 其参数有axis label transparency同样,该参考线也可以用在其他的sgplot图形中。 阅读全文

posted @ 2013-02-13 13:27 colipso 阅读(4517) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc sgplot散点图
摘要:1 proc sgplot data=mysas.mmstwo;2 scatter x=wangnei y=wangjian/group=city;3 run;还可以加上xaxis and yaxis 选项 其参数有label type values. 阅读全文

posted @ 2013-02-13 13:19 colipso 阅读(4260) 评论(0) 推荐(0) 编辑

【sas notes】proc sgplot
摘要:1 proc sgplot data=mysas.mmsone;2 vbar date /response=wangnei stat=mean group=city;3 run;标准格式proc sgplot data=***; vbar(或hbar) variablename /options;options include:response stat group barwidth transparency.用于分类变量或非连续变量,也是一般在excel中常用的柱状图。2、对连续型变量用histogram和density来查看分布方式。histogram的参数有:scal and ... 阅读全文

posted @ 2013-02-13 13:09 colipso 阅读(3404) 评论(0) 推荐(0) 编辑

【sas notes】sas9.2安装
摘要:注意事项:1、看sid的起始和结束时间,系统时间需要设定在介于他们之间。 阅读全文

posted @ 2013-02-13 12:15 colipso 阅读(371) 评论(0) 推荐(0) 编辑

【SAS NOTES】系统自带变量+%if
摘要:1、&sysdate &sysday2、在宏中使用%if1 %macro select(num= );2 %if &num<15 %then %let date='201112';3 %else %let date ='201201';4 proc print data=mysas.Gprsprice_order;5 where date=&date;6 run;7 %mend;8 %select(num=10);%if 可以和%let一起使用 阅读全文

posted @ 2013-02-09 11:25 colipso 阅读(517) 评论(0) 推荐(0) 编辑

【SAS NOTES】宏
摘要:1、宏名称前加% 宏变量前加&例如:%let abc=this is an instance;在使用中需要用&abc的格式。同时字符型宏变量在赋值时不需要加上引号。sas会在单引号引用的文本中替换宏变量,如果需要,则需要对文本加上双引号。1 %let city=dg;2 proc print data=mysas.mmstwo;3 where city="&city";4 run;在使用中注意在文本赋值上使用双引号。2、定义宏片段1 %macro sample;2 proc print data=mysas.mmstwo;3 where city=& 阅读全文

posted @ 2013-02-09 11:08 colipso 阅读(966) 评论(0) 推荐(0) 编辑

【SAS NOTE】在proc means中根据某变量的范围进行统计+proc format
摘要:1 proc format; 2 value feegroup 3 low-500='0~500' 4 501-1000='500~1000' 5 1001-5000='1000~5000' 6 5001-high='>5000'; 7 run; 8 proc means data=guanhui.buedetail_same_sum_fee; 9 var serv_number_num;10 class sumfee;11 format sumfee feegroup.;12 run;注意:1、proc format 后v 阅读全文

posted @ 2013-02-04 15:22 colipso 阅读(1355) 评论(0) 推荐(0) 编辑

【SAS NOTES】在一个data中生成多个数据集
摘要:利用if判断+output的选项实现该功能。 1 data mysas.mmsuser_dec mysas.mmsuser_nov mysas.mmsuser_other; 2 infile 'E:\SAS\mysas\mmsuser.txt' dlm='09'x firstobs=2; 3 input date $ city $ a b c d; 4 if date='201211' then output mysas.mmsuser_dec; 5 else if date='201212' then output mysas. 阅读全文

posted @ 2013-02-03 20:49 colipso 阅读(3152) 评论(0) 推荐(0) 编辑

【SAS NOTES】update
摘要:类似merge,update可以对数据集进行更新,但源数据集需要对关键字进行排序。而且备用数据集的结构要同源数据集保持一致。 1 data mysas.mmsuserdec; 2 infile 'E:\SAS\mysas\mmsuserdec.txt' dlm='09'x firstobs=2; 3 input date $ city $ a b c d; 4 run; 5 data mysas.mmsuserdec_replace; 6 infile 'E:\SAS\mysas\mmsuserdec_replace' dlm='09&# 阅读全文

posted @ 2013-02-03 20:27 colipso 阅读(520) 评论(0) 推荐(0) 编辑

【SAS NOTES】两个数据集merge
摘要:根据关键字,将多个数据集的相同关键字的数据合并到同一行。前提:1、数据集需要按照关键字排序、2、多个数据集除了关键字有相同变量名外,其余想合并到一起的变量其变量名不能相同,否则不能合并。 1 data mysas.mmsuserdec; 2 infile 'E:\SAS\mysas\mmsuserdec.txt' dlm='09'x firstobs=2; 3 input date $ city $ a b c d; 4 run; 5 data mysas.mmsusernov; 6 infile 'E:\SAS\mysas\mmsusernov.txt 阅读全文

posted @ 2013-02-03 14:50 colipso 阅读(6332) 评论(0) 推荐(1) 编辑

【SAS NOTES】两个数据集直接合并-不考虑关键字匹配
摘要:1.sas会根据变量名进行直接合并,对于不同的变量名在其他数据集的数据里直接置空值。1 data mysas.gprsprict_cal_mer;2 set mysas.gprsprice_cal mysas.gprsprice;3 run;2.如果合并的两个或多个数据集已经根据某关键字排序,那么新数据集可以用如下方式在生成的时候直接排序。1 data mysas.gprsprice_order;2 set mysas.gprsprice_cal mysas.gprsprice;3 by date;4 run; 阅读全文

posted @ 2013-02-02 20:30 colipso 阅读(1781) 评论(0) 推荐(0) 编辑

【SAS NOTES】if then和if的区别
摘要:21 data mysas.gprsprict_cal_mer;22 set mysas.gprsprice_cal mysas.gprsprice;23 if shen<0.04 then shen_a=shen*10;24 run;与27 data mysas.gprsprict_cal_mer;28 set mysas.gprsprice_cal mysas.gprsprice;29 if shen<0.04;30 shen_a=shen*10;31 run;的结果有区别,对if来讲,不符合条件的数据会直接忽略,而if ... 阅读全文

posted @ 2013-02-02 20:17 colipso 阅读(1538) 评论(0) 推荐(0) 编辑

【SAS NOTES】data set if
摘要:data mysas.gprsprice_cal; set mysas.gprsprice; if guang<0.04; guang_a=guang*10;run;只有符合if条件的数据才会被放入新的数据集中。 阅读全文

posted @ 2013-02-02 20:10 colipso 阅读(446) 评论(0) 推荐(0) 编辑

【SAS NOTES】kindex判断字符串中是否含某子字符串& 用where在data步中选择部分数据
摘要:Syntax KINDEX(source, excerpt)Argumentssource specifies the character expression to search.excerpt specifies the string of characters to search for in the character expression.Tip: Enclose a literal string of characters in quotation marks.------------------------------------------------------------- 阅读全文

posted @ 2013-02-01 16:18 colipso 阅读(6625) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc sql
摘要:1 proc sql;2 select pay_month,count(distinct(serv_number)) from guanhui.buedetail_same group by pay_month;3 quit;在sas中直接写sql语句并用ods进行输出是一个做分析处理的好方法。 阅读全文

posted @ 2013-02-01 15:30 colipso 阅读(406) 评论(0) 推荐(0) 编辑

【SAS NOTES】字符串处理函数
摘要:1.Missing(),如果变量有缺失值,则返回真。如data test_miss; set learn.blood; if missing(Gender) then MissGender + 1; if missing(WBC) then MissWBC + 1; if missing(RBC) then MissWBC + 1; if Chol lt 200 and not missing(Chol) then Level = 'Low '; else if Chol ge 200 then Level = 'High';run;当变量名形如x1-x5... 阅读全文

posted @ 2013-02-01 11:40 colipso 阅读(6674) 评论(0) 推荐(0) 编辑

【SAS NOTES】proc tabulate遇到的问题
摘要:仍然是由于脏数据引起的问题。在日期字段上正常值为2012-01-01 01:54:58 但某个月的某部分值却为40909.0149537037这种形式,于是在处理的时候这部分的日期就会有问题。但另有年月字段,所以单以该字段统计月就没有问题,如果和天,小时放到一起统计,那么对时间不正常的观测值就会忽略。1 proc tabulate data=a;2 class pay_month weekday hour;3 var fee;4 table pay_month,(n max min mean sum median)*fee;5 table weekday,(n ... 阅读全文

posted @ 2013-02-01 11:38 colipso 阅读(1001) 评论(0) 推荐(0) 编辑

【SAS NOTES】将文本转化为数据格式 input()
摘要:fee=input(fee_a,best.) 阅读全文

posted @ 2013-02-01 09:56 colipso 阅读(756) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示