code: def top(self, var: str, n: int = 10, order: str = 'freq', title: str = '') -> object:
          
          code = "proc freq data=%s.%s %s order=%s noprint;" % (self.libref, self.table, self._dsopts(), order)
          code += "\n\ttables %s / out=tmpFreqOut;" % var
          code += "\nrun;"
          if len(title) > 0:
              code += '\ttitle "' + title + '";\n'
          code += "proc print data=tmpFreqOut(obs=%s); \nrun;" % n
          code += 'title;'
  
          if self.sas.nosub:
              print(code)
              return
  
          ll = self._is_valid()
          if self.results.upper() == 'PANDAS':
              code = "proc freq data=%s.%s%s order=%s noprint;" % (self.libref, self.table, self._dsopts(), order)
              code += "\n\ttables %s / out=tmpFreqOut;" % var
              code += "\nrun;"
              code += "\ndata tmpFreqOut; set tmpFreqOut(obs=%s); run;" % n
              return self._returnPD(code, 'tmpFreqOut')
          else:
              if self.HTML:
                  if not ll:
                      ll = self.sas._io.submit(code)
                  if not self.sas.batch:
                      self.sas.DISPLAY(self.sas.HTML(ll['LST']))
                  else:
                      return ll
              else:
                  if not ll:
                      ll = self.sas._io.submit(code, "text")
                  if not self.sas.batch:
                      print(ll['LST'])
                  else:
                      return ll
docs: Return the most commonly occuring items (levels)
  
          :param var: the CHAR variable (column) you want to count
          :param n: the top N to be displayed (defaults to 10)
          :param order: default to most common use order='data' to get then in alphbetic order
          :param title: an optional Title for the chart
          :return: Data Table