数据分析师-Week16
2018-01-25 本文已影响13人
梁脚毛
1.调用rar解压.rar
# python code
with open(filepath, open='w') as file:
file.write(content)
/*sas code*/
*byte(34)代表双引号,由于路径带空格,需要使用到双引号;
*生成bat可执行文件;
data _null_;
file batpath lrecl=32767;
format cmd ...
cmd=byte(34) || "D:\Program Files\winrar.exe" || byte(34) || "x -ppassword rarpath\rarname outpath";
put cmd;
cmd="exit";
put cmd;
run;
*运行bat;
options wait;
data _null_;
x "bat path";
run;
2.在宏(macro)中高亮显示关键字
%local trick_stupid_sas; %let trick_stupid_sas=%nrstr(%mend);
/*只要%macro后出现了%mend关键字,sas就会默认macro已经结束*/
3.用宏macro处理参数并返回结果
%macro add(a,b);
%let result=%eval(&a.*&b.);
&result.
%mend add;
%let c=%add(1,3);