Created
August 25, 2018 03:20
-
-
Save FriedEgg/7dce842d09087f62e4ba04d4667c4ebc to your computer and use it in GitHub Desktop.
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
| from win32com.client.dynamic import Dispatch | |
| factory = Dispatch("SASObjectManager.ObjectFactoryMulti2") | |
| serverDef = Dispatch("SASObjectManager.ServerDef") # no extra properties... local/zero-config server | |
| sas = factory.CreateObjectByServer("SASApp", True, serverDef, "", "") | |
| code = """ | |
| *pre-code; | |
| filename _foo temp; | |
| ods html5(id=_foo) file=_foo style=Pearl; | |
| *code-code; | |
| proc means data=sashelp.cars mean mode min max; run; | |
| *post-code; | |
| ods html5(id=_foo) close; | |
| """ | |
| sas.LanguageService.Submit(code) | |
| _foo = sas.FileService.UseFileref("_foo") | |
| tstream = _foo.OpenTextStream(1, 32767) # 1=StreamOpenModeForReading | |
| results = "" | |
| while True: | |
| text = tstream.Read(1024) | |
| results += text | |
| if not text: | |
| break | |
| print(results) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment