![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SAS
sola4u
这个作者很懒,什么都没留下…
展开
-
sas 累加函数
data a;input x;cards;1232123;data b;set a;y+x;retain y;if y > 5 then do;y =0;end;proc print;run;Obsxy11122333042251原创 2015-06-16 23:35:45 · 5861 阅读 · 0 评论 -
SAS 一道题目
SAS codedata a;infile datalines dsd;input id $ var1 var2 var3$ ;datalines;001,1,,001,,2,001,,,a 002,4,,002,,5,002,,,6;run;%macro test(num); data work.b# set work.a(keep=原创 2016-10-20 16:16:57 · 937 阅读 · 0 评论 -
SAS 数数
data a;input id name$ @@;cards;1 梁波1 梁波1 梁波2 徐传2 徐传3 曾成2 梁波3 曾成4 尹成2 徐传;proc sort data = a out = b;by id;data c;set b;by id;if first.id then y = .;else;y + 1;if last.id;run;proc原创 2015-05-14 20:19:16 · 785 阅读 · 0 评论 -
SAS t值表
data work.tvalue; array p{10} p1-p10 (0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.10, 0.20, 0.40, 0.50); array tvalue{10}; do i = 1 to 10; do j = 1 to 10; tvalue{j} = abs(tinv(p{j}/2, i)); end原创 2015-09-05 21:35:17 · 2397 阅读 · 0 评论 -
SAS 补零
data a; input x; y = put(x,z10.); cards; 1 12 123 1234 12345 ;run;proc print;run;Obsxy11000000000121200000000123123000000012341234原创 2015-08-18 08:51:18 · 4025 阅读 · 0 评论 -
sas vname 返回最大值对应的变量名
data a; input a b c @@; cards; 1 2 3 4 5 2 9 8 3 ;run;data b; set a; array arr a b c ; do over arr; if arr = max(of arr(*)) then y = vname(arr); end;proc print;run;Obsa翻译 2015-08-14 15:57:40 · 5852 阅读 · 0 评论 -
SAS 打分
data a; array question{4}$; array answer{4}$ ('a','b','c','d'); array score{4}; input question1-question4 ; do i = 1 to 4; if question{i} = answer{i} then score{i} = 1; else score{i} = 0; e原创 2015-08-13 10:37:10 · 1263 阅读 · 0 评论 -
SAS数据导出导入
http://blog.163.com/chensx_326/blog/static/1540079520078237414664/一、导入导出文本文件(txt格式)、纯数据文件(dat格式);其实都是导入导出DLM文件(*.*),需要指定分隔符号。如下(以txt为例,dat同样):1.TAB分割,第一行为变量名PROC IMPORT OUT=转载 2015-04-13 16:38:00 · 9491 阅读 · 0 评论 -
retain
data a; input name $ group @@; retain name2; if group = 1 then name2 = name; cards;zhang 1. 2. 3li 1wang 1sun 1. 2. 3. 4 ;run;proc print;run;Obsnamegroupname2原创 2015-08-10 15:38:12 · 385 阅读 · 0 评论 -
COMPRESS 函数
COMPRESS 函数【功能】从一个字符串移除特定的字符Syntax1compress ()source: 指定一个字符串来源chars: 指定要删除或者保留的字符列表,需用引号modifiers: 指定修饰符,不区分大小写,用来控制 compress 函数的具体功能。如: a 增加(A - Z, a - z转载 2015-06-10 14:58:52 · 1307 阅读 · 0 评论 -
proc transpose
data a;input x$ y$ z @@;cards;a x 10b y 10c z 15a y 11b z 12c x 13a z 14b x 19c y 20;proc sort data = a out = b;by x;proc transpose data = b out = c let prefix = a;id y;by x;run;原创 2015-06-09 18:00:16 · 2973 阅读 · 0 评论 -
sas call sortc 函数
data a;input x$ y$ @@;cards;a bc db ad ca b;data b;set a;call sortc(x,y);proc sql;create table c asselect distinct x,y from b;quit;proc print;run;call sortc;call sor原创 2015-06-06 20:42:56 · 1654 阅读 · 0 评论 -
SAS学习日记-素数
data a;do i = 1 to 100; do j = 2 to i-1; if mod(i, j) = 0 and j if j = i-1 then ouput;end;end;run;原创 2015-04-08 14:53:35 · 1294 阅读 · 0 评论 -
SAS like
data a; input x $ ; cards; zhong zhang wang li sun zeng ;run;data b;set a;where x like 'zh%';run;proc print;run;Obsx1zhong2zhang3zeng原创 2015-06-20 17:34:22 · 5970 阅读 · 1 评论 -
死因分析sas代码
options mstored sasmstore = reporter;options papersize = a4 orientation = landscape;libname reporter 'E:\2017\死因监测\总结\';%let dir = E:\2017\死因监测\总结\;%let base = 11.csv; *大疫情死因系统导出死因数据;%let ppl = ...原创 2017-03-28 11:04:50 · 1538 阅读 · 0 评论