Skip to content

Instantly share code, notes, and snippets.

@joedougherty
Created August 29, 2014 14:11
Show Gist options
  • Save joedougherty/225703af7e071d1287be to your computer and use it in GitHub Desktop.
Save joedougherty/225703af7e071d1287be to your computer and use it in GitHub Desktop.
InlineSAS
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)
@FlipperPA
Copy link

Good to see someone is finally using Python for something useful. There's a first for everything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment