This method returns the list of currently assigned librefs

def assigned_librefs(self):
        """
        This method returns the list of currently assigned librefs
        """

        code = """
        data _null_; retain libref; retain cobs 1; 
           set sashelp.vlibnam end=last;
           if cobs EQ 1 then
              put "LIBREFSSTART";
           cobs = 2;
           if libref NE libname then
              put "LIBREF=" libname;
           libref = libname;
           if last then
              put "LIBREFSEND";
        run;
        """

        if self.nosub:
            print(code)
            return None
        else:
           ll = self.submit(code, results='text')

        librefs = []
        log = ll['LOG'].rpartition('LIBREFSEND')[0].rpartition('LIBREFSSTART')
                                                                                  
        for i in range(log[2].count('LIBREF=')):                                    
           log = log[2].partition('LIBREF=')[2].partition('\n')                    
           librefs.append(log[0].strip())                                                         
                                                                                  
        return librefs