SAS--chapter12

  

libname clinic 'D:\sas';
data lab23.drug1h(drop=placebo uric);
set research.cltrials(drop=triglyc);
if sex='M' then delete;
if placebo='YES';
TestDate='22MAY1999'd;
retain Days 30;
days+1;
length Retest $ 5;
if cholesterol>190 then retest='YES';
else if 150<=cholesterol<=190 then retest='CHECK';
else if cholesterol<150 then retest='NO';
label retest='Perform Cholesterol Test 2?';
format enddate mmddyy10.;
run;

data clinic.data1017(drop=sex);
    set sasuser.diabetes(keep=age);  *drop
    if sex='F';
run;

*proc sort  out  by (排序)
print by  (subtotal)
data by (排序);
proc sort data=clinic.data1016 out=data;
by height;
run;
data data1;
    set data;
    by height;   *by之前,该变量必须已经被排序了??//有一个appropriate index;
run;

* 查看一个单位;
data data2;
    obsnum=5;
    set clinic.admit point =obsnum;
    output;   *没有output和stop,无限循环;有stop,无output,空数据集;;
            *有output无stop,无限多个第五观察值;
run;            *输入文件会有一个end-of-file marker,但是point指定了一个变量,则没有这个marker,所以需要stop;

data data3 data4;    *同时创建两个data set ,只有output中的data有内容;
    set clinic.admit;
    output data3;
run;

data data5;
    set clinic.admit end=last;  *读累加后变量(he)的最后一个值=总计;
    he+height;                    *end 和point不能在同一step;
    we+weight;
    fe+fee;
    if last;
run;

 

上一篇:Spring事务管理的三种方式


下一篇:体感在js中的调用