摘要: Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06 Select CONVERT(varchar(100), GETDA 阅读全文
posted @ 2016-02-05 04:29 Sunny Qiang 阅读(498) 评论(0) 推荐(0) 编辑
摘要: /*datepart()函数的使用*datepart()函数可以方便的取到时期中的各个部分*如日期:2006-07--0218:15:36.513*yy:取年2006*mm:取月7*dd:取月中的天2*dy:取年中的天183*wk:取年中的周27*dw:取周中的天1*qq:取年中的季度3*hh:取小... 阅读全文
posted @ 2015-10-13 05:26 Sunny Qiang 阅读(11895) 评论(0) 推荐(0) 编辑
摘要: "/" Or Right(SavePath,1)"/" Then SavePath = Trim(SavePath) & "/"If Left(dbFileName,1)="/" Or Left(dbFileName,1)="/" Then dbFileName = Trim(Mid(dbFileN... 阅读全文
posted @ 2015-10-05 23:24 Sunny Qiang 阅读(2042) 评论(0) 推荐(0) 编辑
摘要: 1 2 private static final double EARTH_RADIUS = 6378137;//赤道半径(单位m) 3 4 /** 5 * 转化为弧度(rad) 6 * */ 7 private static d... 阅读全文
posted @ 2015-06-24 03:48 Sunny Qiang 阅读(1076) 评论(0) 推荐(0) 编辑
摘要: 打开文档后,按Alt+F11,在左边Porject下找到ThisDocument,右键插入模块,贴上下面的Sub Macro()For Each iShape In ActiveDocument.InlineShapesiShape.Height = iShape.Height * 0.25iSha... 阅读全文
posted @ 2015-05-27 10:19 Sunny Qiang 阅读(258) 评论(0) 推荐(0) 编辑
摘要: data test; x="aaa bbb hahaha"; x1=compress(x); x2=left(x); put x1=; put x2=; run;x1=aaabbbhahahax2=aaa bbb hahaha 阅读全文
posted @ 2015-04-17 12:27 Sunny Qiang 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 让一个程序应用于一个目录中所有的数据集 1 libname data 'C:\'; 2 proc sql noprint; 3 select distinct 'data.'||memname into:name1-:name999 4 from sashelp.vtable where libname='DATA'; 5 quit; 6 7 %macro loop; 8 %do i=1 %to &sqlobs.; 9 data h&i;10 set &&name&i;11 a=1;12 run;13 %e 阅读全文
posted @ 2013-06-13 04:00 Sunny Qiang 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 简单随机抽样是在做大数据量分析时经常用到的一个方法。SAS提供了surveyselect过程步,可以很方便的实现。或者用数据步配合随机函数也可以较简便的完成。/*生成100行数据的表*/data temp; do i = 1 to 100; x = i; output; end; drop i;run; /*使用proc surveyselect随机抽取10%*/proc surveyselect data=temp method=srs rate=0.1 out=temp_2;run;/*rate=10也可以*/proc surveyselec... 阅读全文
posted @ 2013-02-12 22:49 Sunny Qiang 阅读(1416) 评论(0) 推荐(0) 编辑
摘要: 一 获取重复的数据的值select user_name from usersgroup by user_namehaving(count(1)>1)二 获取重复数据的记录select * from users where user_name in( select user_name from users group by user_name having(count(1)>1))三查找表中多余的重复记录(多个字段)select * from vitae where (a.peopleId,a.seq) in (select peopleId,seq from vitae gro.. 阅读全文
posted @ 2013-02-05 15:42 Sunny Qiang 阅读(1291) 评论(0) 推荐(0) 编辑
摘要: select语句中只能使用sql函数对字段进行操作(链接sql server), select 字段1 from 表1 where 字段1.IndexOf("云")=1; 这条语句不对的原因是indexof()函数不是sql函数,改成sql对应的函数就可以了。 left()是sql函数。 select 字段1 from 表1 where charindex('云',字段1)=1;字符串函数对二进制数据、字符串和表达式执行不同的运算。此类函数作用于CHAR、VARCHAR、 BINARY、 和VARBINARY 数据类型以及可以隐式转换为CHAR 或VARCH 阅读全文
posted @ 2013-02-01 11:54 Sunny Qiang 阅读(282) 评论(0) 推荐(0) 编辑