我只想保留具有特定格式的列。例如,sashelp.cars
有2列格式为DOLLAR
的列-MSRP
和INVOICE
。我只想保留这两列。任何帮助表示赞赏!
答案 0 :(得分:2)
您可以使用dictionary.columns来做到这一点。
proc sql ;
select name into :keepcols SEPARATED by " " from dictionary.columns
where libname = "SASHELP"
and memname = "CARS"
and format = "DOLLAR8.";
Edit1:您可以使用“ DOLLAR%”之类的格式来查找所有采用美元格式的文件;
proc sql ;
select name into :keepcols SEPARATED by " " from dictionary.columns
where libname = "SASHELP"
and memname = "CARS"
and format like "DOLLAR%";
data cars;
set sashelp.cars(keep = &keepcols);
run;