{smcl} {* *! version 0.9 01 March 2012}{...} {vieweralsosee "euse" "help euse"}{...} {vieweralsosee "export" "help export"}{...} {vieweralsosee "export excel" "help import_excel"}{...} {vieweralsosee "export sasxport" "help export_sasxport"}{...} {vieweralsosee "outsheet" "help outsheet"}{...} {vieweralsosee "save" "help save"}{...} {vieweralsosee "saveold" "help saveold"}{...} {vieweralsosee "xmlsave" "help xmlsave"}{...} {viewerjumpto "Syntax" "esave##syntax"}{...} {viewerjumpto "Description" "esave##description"}{...} {viewerjumpto "Options" "esave##options"}{...} {viewerjumpto "Main options" "esave##options_main"}{...} {viewerjumpto "Options for ASCII data" "esave##options_ascii"}{...} {viewerjumpto "Options for spreadsheets" "esave##options_sheet"}{...} {viewerjumpto "Other options" "esave##options_other"}{...} {viewerjumpto "Remarks" "esave##remarks"}{...} help for {cmd:esave}{right:version 0.9 (01 March 2012)} {hline} {title:Title} {phang} {bf:esave} {hline 2} extended save {title:Table of contents} {help esave##syntax:Syntax} {help esave##description:Description} {help esave##options:Options} {space 2}{help esave##options_main:Main options} {space 2}{help esave##options_ascii:Options for ASCII export} {space 2}{help esave##options_sheet:Options for spreadsheet export} {space 2}{help esave##options_other:Other options} {help esave##remarks:Remarks} {help esave##author:Author} {help esave##alsosee:Also see} {marker syntax} {title:Syntax} {p 8 17 2} {cmd:esave} [{cmd:using}] {it:filename} [, {it:options}] {p_end} {synoptset 30 tabbed}{...} {synopthdr} {synoptline} {syntab:Main} {synopt:{opt for:mat(string)}}data format for file export{p_end} {syntab:Options for ASCII export} {synopt:{opt delim:iter("char")}}use {it:char} as delimiter ({it:ascii_custom} format only){p_end} {synopt:{opt non:ames}}do not write variable names on the first line ({it:ascii_custom}, {it:ascii_tab}, {it:ascii_comma} and {it:ascii_semicolon} formats only){p_end} {synopt:{opt noq:uote}}do not enclose strings in double quotes ({it:ascii_custom}, {it:ascii_tab}, {it:ascii_comma} and {it:ascii_semicolon} formats only){p_end} {syntab:Options for spreadsheet export} {synopt:{opt sh:eet("sheetname")}}saves to the worksheet named {it:sheetname} ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt cell(start)}}specifies the start (upper-left) cell in the Excel worksheet to begin saving to ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt sheetmod:ify}}exports data to the worksheet without changing the cells outside the exported range ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt sheetrep:lace}}clears the worksheet before the data are exported to it ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{cmdab:first:row(}{cmdab:var:iables}|{cmdab:varl:abels}{cmdab:)}}specifies that the variable names or the variable labels be saved in the first row in the Excel worksheet ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt date:string("datetime_format")}}exports all datetime variables as strings formatted by {it:datetime_format} ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt miss:ing("repval")}}exports missing values as {it:repval} ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt locale("locale")}}specifies the locale used by the workbook ({it:ooxml} and {it:excel} formats only){p_end} {synopt:{opt leg:ible}}format XML to be more legible ({it:xml_excel} and {it:xml_stata} formats only){p_end} {syntab:Other options} {synopt:{opt nol:abel}}export values instead of value labels, if any ({it:ooxml}, {it:excel}, {it:ascii_custom}, {it:ascii_tab}, {it:ascii_comma}, {it:ascii_semicolon}, {it:stata} and {it:stata_old} formats only){p_end} {synopt:{opt o:rphans}}save all value labels ({it:stata} format only){p_end} {synopt:{opt empty:ok}}save dataset even if zero observations and zero variables ({it:stata} format only){p_end} {synopt:{opt all}}save {bf:e(sample)} with the dataset; programmer's option ({it:stata} and {it:stata_old} formats only){p_end} {synopt:{opt ren:ame}}rename variables and value labels to meet SAS XPORT restrictions ({it:sas} format only){p_end} {synopt:{cmdab:val:labfile(}{cmdab:xpf}{cmdab:)}}save value labels in {bf:formats.xpf} ({it:sas} format only){p_end} {synopt:{cmdab:val:labfile(}{cmdab:sas:code}{cmdab:)}}save value labels in SAS command file ({it:sas} format only){p_end} {synopt:{cmdab:val:labfile(}{cmdab:both}{cmdab:)}}save value labels in {bf:formats.xpf} and in a SAS command file ({it:sas} format only){p_end} {synopt:{cmdab:val:labfile(}{cmdab:none}{cmdab:)}}do not save value labels ({it:sas} format only){p_end} {synopt:{opt replace}}overwrite existing file without warning{p_end} {synopt:{opt verbose}}give verbose output{p_end} {synoptline} {p2colreset}{...} {marker description} {title:Description} {pstd} {bf:esave} is a wrapper for Stata's most common file export commands. Currently, it can replace the commands {cmd:save}, {cmd:saveold}, {cmd:outsheet}, {cmd:export excel}, {cmd:export sasxport} (formerly: {cmd:fdasave}) and {cmd:xmlsave}. {p_end} {pmore}For ease of use, {cmd:esave} provides one single command to write various dataset formats. It determines which of Stata's export commands to use by the {opt format} option, or, if not specified, by parsing the filename's file extension. Thereby, it can pass through various commonly used options to the appropriate file export routine.{p_end} {marker options}{...} {title:Options} {marker options_main}{...} {dlgtab:Main} {phang} {opt format(format)} file {it:format} to write the using file to. {p_end} {pmore}If not specified, the appropriate format is guessed by the given file extension, if any. If this is not possible, {it:stata} format is used.{p_end} {pmore}Supported {it:format}s are:{p_end} {pmore}{bf:stata}: Stata file format (typical extension: {it:dta}). This is equivalent to running the command {cmd:save}. {break}This is the default if no {it:format} is specified and the file extension is {it:dta}.{p_end} {pmore}{bf:stata_old}: Stata file format (typical extension: {it:dta}), old version. This is equivalent to running the command {cmd:saveold}. {break}Note that the file format version is dependent on your Stata's version: Stata 12 will save in datasets suitable for Stata 9/10, whilst Stata 11 will save in Stata 8/9 format, and so on.{p_end} {pmore}{bf:ascii_tab}: ASCII format, tab-separated (typical extension: {it:txt} or {it:dat}). This is equivalent to running the command {cmd:outsheet}. {break}This is the default if no {it:format} is specified and the file extension is {it:dat}.{p_end} {pmore}{bf:ascii_comma}: ASCII format, comma-separated (typical extension: {it:txt} or {it:csv}). This is equivalent to running the command {cmd:outsheet} with option {opt comma}. {break}This is the default if no {it:format} is specified and the file extension is {it:txt} or {it:csv}.{p_end} {pmore}{bf:ascii_semicolon}: ASCII format, semicolon-separated (typical extension: {it:txt} or {it:csv}). This is equivalent to running the command {cmd:outsheet} with option {opt delimiter(";")}. {break}This is needed to seamlessly export a CSV file to Microsoft Excel. Note that it may be easier to use one of the formats {bf:ooxml}, {bf:excel} or {bf:xml_excel} (whilst {bf:ooxml} is recommended in this case).{p_end} {pmore}{bf:ascii_custom}: ASCII format, separated by custom character. This is equivalent to running the command {cmd:outsheet}. {break}You need to specify the {opt delimiter} option for this format, or it will be changed to {it:ascii_tab}.{p_end} {pmore}{bf:ooxml}: Microsoft Excel spreadsheet format, version of Microsoft Office 2007 or newer (typical extension: {it:xlsx}) - also known as Office Open XML (OOXML). This is equivalent to running the command {cmd:export excel}. This is the recommended option for exporting spreadsheets. {break}This is the default if no {it:format} is specified and the file extension is {it:xlsx}, and will be overridden if the file extension is {it:xls}.{p_end} {pmore}{bf:excel}: Microsoft Excel spreadsheet format, version prior to Microsoft Office 2007 (typical extension: {it:xls}). This is equivalent to running the command {cmd:export excel}. This is not recommended unless you necessarily have to export to old Excel versions, in any other case please consider using the {it:ooxml} format. {break}It is the default if no {it:format} is specified and the file extension is {it:xls}, and will be overridden if the file extension is {it:xlsx}.{p_end} {pmore}{bf:sas}: SAS XPORT format (typical extension: {it:xpt}). This is equivalent to running the command {cmd:export sasxport} (in Stata 12 or newer) or {cmd:fdause} (older Stata versions). {break}This is the default if no {it:format} is specified and the file extension is {it:xpt}.{p_end} {pmore}{bf:xml_stata}: XML file format, Stata DTD (typical extension: {it:xml}). This is equivalent to running the command {cmd:xmlsave} with option {opt doctype(dta)}.{p_end} {pmore}{bf:xml_excel}: XML file format, Microsoft SpreadsheetML DTD (typical extension: {it:xml}). This is equivalent to running the command {cmd:xmlsave} with option {opt doctype(excel)}. {break}This is the default if no {it:format} is specified and the file extension is {it:xml}.{p_end} {marker options_ascii}{...} {dlgtab:Options for ASCII export} {phang} {opt demiliter(char)} use {it:char} as delimiter. This option is only valid with the {it:ascii_custom} format, and mandatory for this format; it will be passed to {cmd:outsheet}. See the corresponding help file for details: {help outsheet##options:outsheet} {p_end} {phang} {opt nonames} do not write variable names on the first line. This option is only valid with one of the formats {it:ascii_custom}, {it:ascii_tab}, {it:ascii_comma} or {it:ascii_semicolon}, and will be passed to {cmd:outsheet}. Refer to the corresponding help file for details: {help outsheet##options:outsheet} {p_end} {phang} {opt noquote} do not enclose strings in double quotes. This option is only valid with one of the formats {it:ascii_custom}, {it:ascii_tab}, {it:ascii_comma} or {it:ascii_semicolon}, and will be passed to {cmd:outsheet}. Refer to the corresponding help file for details: {help outsheet##options:outsheet} {p_end} {marker options_sheet}{...} {dlgtab:Options for spreadsheet export} {phang} {opt sheet("sheetname")} saves to the worksheet named {it:sheetname}. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt cell(start)} specifies the start (upper-left) cell in the Excel worksheet to begin saving to. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt sheetmodify} exports data to the worksheet without changing the cells outside the exported range. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt sheetreplace} clears the worksheet before the data are exported to it. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {cmd:firstrow(}{cmd:variables}|{cmd:varlabels}{cmd:)} specifies that the variable names or the variable labels be saved in the first row in the Excel worksheet. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt datestring("datetime_format")} exports all datetime variables as strings formatted by {it:datetime_format}. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt missing("repval")} exports missing values as {it:repval}. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt locale("locale")} specifies the locale used by the workbook. This option is only valid with one of the formats {it:ooxml} or {it:excel}, and will be passed to {cmd:export excel}. Refer to the corresponding help file for details: {help import_excel##exportoptions:export excel} {p_end} {phang} {opt legible} format XML to be more legible. This option is only valid with the {it:xml_excel} format, and will be passed to the {cmd:xmlsave}. Refer to the corresponding help file for details: {help xmlsave##options_xmlsave:xmlsave} {p_end} {marker options_other}{...} {dlgtab:Other options} {phang} {opt nolabel} export values instead of value labels, if any. This option is only valid with one of the formats {it:ooxml}, {it:excel}, {it:ascii_custom}, {it:ascii_tab}, {it:ascii_comma}, {it:ascii_semicolon}, {it:stata} or {it:stata_old}, and will be passed to the appropriate export command. Refer to the corresponding help files for details: {help save##options_save:save}, {help save##options_saveold:saveold}, {help import_excel##exportoptions:export excel}, {help outsheet##options:outsheet} {p_end} {phang} {opt orphans} save all value labels. This option is only valid with the {it:stata} format, and will be passed to {cmd:save}. Refer to the corresponding help file for details: {help save##options_save:save} {p_end} {phang} {opt emptyok} save dataset even if zero observations and zero variables. This option is only valid with the {it:stata} format, and will be passed to {cmd:save}. Refer to the corresponding help file for details: {help save##options_save:save} {p_end} {phang} {opt all} save {bf:e(sample)} with the dataset; programmer's option. This option is only valid with one of the formats {it:stata} or {it:stata_old}, and will be passed to the appropriate export command. Refer to the corresponding help files for details: {help save##options_save:save}, {help save##options_saveold:saveold} {p_end} {phang} {opt rename} rename variables and value labels to meet SAS XPORT restrictions. This option is only valid with the {it:sas} format, and will be passed to the appropriate export command. Refer to the corresponding help file for details: {help import_sasxport##options_export:export sasxport} (Stata 12 or newer) or {help fdasave##fdasave_options:fdasave} (older verions of Stata) {p_end} {phang} {cmdab:vallabfile(}{cmdab:xpf}{cmdab:)} save value labels in {bf:formats.xpf} This option is only valid with the {it:sas} format, and will be passed to the appropriate export command. Refer to the corresponding help file for details: {help import_sasxport##options_export:export sasxport} (Stata 12 or newer) or {help fdasave##fdasave_options:fdasave} (older verions of Stata) {p_end} {phang} {cmdab:vallabfile(}{cmdab:sascode}{cmdab:)} save value labels in SAS command file This option is only valid with the {it:sas} format, and will be passed to the appropriate export command. Refer to the corresponding help file for details: {help import_sasxport##options_export:export sasxport} (Stata 12 or newer) or {help fdasave##fdasave_options:fdasave} (older verions of Stata) {p_end} {phang} {cmdab:vallabfile(}{cmdab:both}{cmdab:)} save value labels in {bf:formats.xpf} and in a SAS command file This option is only valid with the {it:sas} format, and will be passed to the appropriate export command. Refer to the corresponding help file for details: {help import_sasxport##options_export:export sasxport} (Stata 12 or newer) or {help fdasave##fdasave_options:fdasave} (older verions of Stata) {p_end} {phang} {cmdab:vallabfile(}{cmdab:none}{cmdab:)} do not save value labels This option is only valid with the {it:sas} format, and will be passed to the appropriate export command. Refer to the corresponding help file for details: {help import_sasxport##options_export:export sasxport} (Stata 12 or newer) or {help fdasave##fdasave_options:fdasave} (older verions of Stata) {p_end} {phang} {opt replace} replace {it:filename} without warning if it already exists. If not specified, an error message is triggered in such cases. {p_end} {phang} {opt verbose} drops verbose output during the process. Eventually needed for debugging. {p_end} {marker remarks} {title:Remarks} {pstd}In order to use the import formats {it:ooxml} or {it:excel}, Stata 12 (or newer) is required. If this is not the case, Stata 10 is required.{p_end} {pstd}It is recommended that even if you use Windows, you use forward slashes (/) rather than backward slashes (\) for specifying directory names. Stata will understand and there will then be no clash with other meanings for the backward slash.{p_end} {pstd}This command is part of the NEPmgmt bundle, written to help creating the {browse "https://www.neps-data.de/":NEPS} dataset files.{p_end} {pstd}The source code of the program is licensed under the GNU General Public License version 3 or later. The corresponding license text can be found on the internet at {browse "http://www.gnu.org/licenses/"} or in {help gnugpl}.{p_end} {marker author} {title:Author} {pstd} Daniel Bela ({browse "mailto:daniel.bela@lifbi.de":daniel.bela@lifbi.de}), Leibniz Institute for Educational Trajectories (LIfBi), Germany.{p_end} {marker alsosee} {title:Also see} {psee} {space 2}Help: {help NEPSmgmt}, {help euse}, {help export}, {help export_excel:export excel}, {help export_sasxport:export sasxport}, {help outsheet}, {help save}, {help saveold}, {help xmlsave} {p_end}