Is there a way to run a one-liner in sas, or do I have to create a file? I'm looking for something like the -e flag in perl.
A:
Never having used sas, what I might try is something like:
echo <insert sas code here> | sas --execute-file -
Oftentimes applications will let you specify '-' as a file to have it read from STDIN. And 'echo' just prints its arguments out, and the | connects them together.
davr
2008-11-06 21:00:44
+4
A:
Hi, The Unix version of SAS was ported from MVS years ago and to make a long story short, the SAS executable does not import from STDIN. To make this work in Unix, merely alter slightly the previous suggestion into something like:
echo "your SAS code" > temp;sas -sysin temp
Hope this is helpful,
Mark
There are further command line options to control where the output and log go.
John Fouhy
2008-11-06 23:25:49
+2
A:
My favourite is using the -stdio option
Either:
sas -stdio
Then start typing. Or ...
echo "proc options; run;" | sas -stdio
Rog
2009-02-11 23:38:22