SAS数据集更新
1. modify
更新数据。不能新加变量和观测。可以不用按by排序。
data now; modify old new; by id; replace;*可省略; run;
2. update
可以新增变量,by之前需要排序,by需要唯一,否则只更新by中第一条记录
data now; update old new; by id; run;
3.
dictionary.dictionaries里面有很多数据集,其中一个是描述数据字典的;
proc sql; select unique memname, memlabel from dictionary.dictionaries ; quit; proc sql; select * from dictionary.columns ; quit; data a; set sashelp.vtable; run;
4. append
增加观测
proc append base=old data=new force; run;
force是把new中所有变量和观测都追加到old数据集
5. PROC DATASETS
5.1 删除所有数据集
proc datasets lib=work memtype=data kill;
run;
quit;
proc delete data=_all_;
run;
5.2 print数据集信息
proc datasets lib=work; contents data=class; run;
5.3 修改数据集标签
proc datasets lib=work; modify class(label='new');
rename sex=sex1;
label name='姓名' gender='性别'; run;
5.4删除|修改|保存数据集
proc datasets; copy in=sashelp out=work; select class; run; proc datasets lib=work; change class=new;*rename数据集名字; run; proc datasets lib=work; delete work; run; proc datasets lib=work; save work;*删除其余所有数据集; run;
5.5
本文来自博客园,作者:Iving,转载请注明原文链接:https://www.cnblogs.com/SAS-T/p/16340848.html