How to use the saspy.sasbase.SASsession function in saspy

To help you get started, we’ve selected a few saspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sassoftware / saspy / saspy / sas_magic.py View on Github external
try:
                        _mva = getattr(_mva, name)
                    except Exception as e:
                        print(e)
                        break

            if isinstance(_mva, SASsession):
                mva = _mva
            else:
                return 'Invalid SAS Session object supplied'
        elif len(line) and not line in self.shell.user_ns:  # string supplied but not a session
            return 'Invalid SAS Session object supplied'
        else:  # no string should default to unnamed session
            try:
                if mva is None:
                    mva = SASsession()
                    self.mva = mva  # save the session for reuse
                else:
                    mva = self.mva
            except:
                return "this shouldn't happen"
        saveOpts="proc optsave out=__jupyterSASKernel__; run;"
        restoreOpts="proc optload data=__jupyterSASKernel__; run;"
        if len(line)>0:  # Save current SAS Options
            mva.submit(saveOpts)

        if line.lower()=='smalllog':
            mva.submit("options nosource nonotes;")

        elif line is not None and line.startswith('option'):
            mva.submit(line + ';')
github sassoftware / saspy / saspy / sas_magic.py View on Github external
def __init__(self, shell):
        super(SASMagic, self).__init__(shell)
        self.lst_len = -99  # initialize the length to a negative number to trigger function
        self.mva = None
        if self.lst_len < 0 and isinstance(self.mva, SASsession) :
            self._get_lst_len()