Created
August 29, 2014 14:11
-
-
Save joedougherty/225703af7e071d1287be to your computer and use it in GitHub Desktop.
InlineSAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess, os, tempfile | |
def callSAS(sas_str): | |
f = tempfile.NamedTemporaryFile(delete=False) | |
f.write(sas_str) | |
f.close() | |
invocation = ['sas', '-sysin', f.name] | |
r = subprocess.Popen(invocation, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
stdout, stderr = r.communicate() | |
os.unlink(f.name) | |
return (r.returncode, stdout, stderr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good to see someone is finally using Python for something useful. There's a first for everything!