def to_csv(self, file: str, opts: dict = None) -> str:
opts = opts if opts is not None else {}<EOL>ll = self._is_valid()<EOL>if ll:<EOL><INDENT>if not self.sas.batch:<EOL><INDENT>print(ll['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>return ll<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return self.sas.write_csv(file, self.table, self.libref, self.dsopts, opts)<EOL><DEDENT>
This method will export a SAS Data Set to a file in CSV format.

:param file: the OS filesystem path of the file to be created (exported from this SAS Data Set)
:return: