'Returns a Python generator object for iterating over the dataset.
Parameters
as_dict : bool, optional
If as_dict is True, yield each row of observations as a dict.
If False, yields each row of observations as a list.
Returns
Generator object for iterating over the dataset.  Yields each row of
observations as a list by default.
Notes
If missing_values is True during instantiation of StataReader then
observations with _StataMissingValue(s) are not filtered and should
be handled by your applcation.'

def dataset(self, as_dict=False):

    try:
        self._file.seek(self._data_location)
    except Exception:
        pass
    if as_dict:
        vars = lmap(str, self.variables())
        for i in range(len(self)):
            (yield dict(zip(vars, self._next())))
    else:
        for i in range(self._header['nobs']):
            (yield self._next())
