题
有没有办法在sas中运行一行,或者我是否必须创建一个文件?我正在寻找像perl中的-e标志。
解决方案
我最喜欢的是使用-stdio选项
或者:
sas -stdio
然后开始输入。或者......
echo "proc options; run;" | sas -stdio
其他提示
几年前,Unix版本的SAS从MVS移植而来,简而言之,SAS可执行文件不会从STDIN导入。要在Unix中完成这项工作,只需将之前的建议略微改为:
echo "your SAS code" > temp;sas -sysin temp
希望这有用。
sas -initstmt '%put hello world ; endsas ;'
sas -initstmt 'proc print data=sashelp.class; run ;'
当然,这也可能是:
sas -initstmt '%inc large_program.sas; endsas;'
从未使用sas,我可能尝试的是:
echo <insert sas code here> | sas --execute-file -
通常,应用程序会让您将' - '指定为从STDIN读取的文件。并且'echo'只打印出它的参数和|将它们连接在一起。
您还可以使用 -nodms
选项。这将为您提供Base的命令行版本。
不隶属于 StackOverflow