<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Multi sheet csv file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180400#M45975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI: I agree with &lt;A _jive_internal="true" href="https://communities.sas.com/mailto:STAT@SAS"&gt;STAT@SAS&lt;/A&gt;. If you need multiple sheets, then TAGSETS.EXCELXP is a better choice. The fact is that with a CSV file, there is no way to create multiple sheets other the LIBNAME engine or PROC EXPORT -- which won't work with TABULATE. All the output from ODS CSV or ODS CSVALL goes to 1 sheet, which you can prove to yourself by running the attached code.&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods _all_ close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods csvall file='c:\temp\_3_tabulate_steps.csv';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=sashelp.class;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title '1) TABULATE for CLASS';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class age;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; table age all,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n pctn;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=sashelp.cars;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title '2) TABULATE for CARS';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class type;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; table type all,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n pctn;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=sashelp.shoes;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title '3) TABULATE for SHOES';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class product;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; table product all,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n pctn;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods csvall close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Aug 2014 22:53:10 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2014-08-29T22:53:10Z</dc:date>
    <item>
      <title>Multi sheet csv file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180398#M45973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following code to export a PROC tabulate to a csv file.&amp;nbsp; It works fine.&amp;nbsp; However, I want to execute 3 separate tabulates and export them into 1 csv file with each tabulate result in a different sheet, rather than creating three different csv files. Is there a SHEET= option that will allow me to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODS csv file='G:\Departments\Research\MAP\1415\Longitudinal Match\long_match_math.csv' ;&lt;/P&gt;&lt;P&gt;proc tabulate data=join_long;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;title'math results';&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;ods csv close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:19:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180398#M45973</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2014-08-29T19:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Multi sheet csv file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180399#M45974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure about ODS csv but you can try something this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODS TAGSETS.EXCELXP&lt;/P&gt;&lt;P&gt;FILE='G:\Departments\Research\MAP\1415\Longitudinal Match\long_match_math.xls';&lt;/P&gt;&lt;P&gt;STYLE=minimal&lt;/P&gt;&lt;P&gt;OPTIONS ( Sheet_Name = 'Shoes' );&lt;/P&gt;&lt;P&gt;PROC PRINT DATA=sashelp.shoes; RUN;&lt;/P&gt;&lt;P&gt;ODS TAGSETS.EXCELXP&lt;/P&gt;&lt;P&gt;OPTIONS ( Sheet_Name = 'Class' );&lt;/P&gt;&lt;P&gt;PROC PRINT DATA=sashelp.class; RUN;&lt;/P&gt;&lt;P&gt;ODS TAGSETS.EXCELXP CLOSE;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180399#M45974</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-29T19:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Multi sheet csv file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180400#M45975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI: I agree with &lt;A _jive_internal="true" href="https://communities.sas.com/mailto:STAT@SAS"&gt;STAT@SAS&lt;/A&gt;. If you need multiple sheets, then TAGSETS.EXCELXP is a better choice. The fact is that with a CSV file, there is no way to create multiple sheets other the LIBNAME engine or PROC EXPORT -- which won't work with TABULATE. All the output from ODS CSV or ODS CSVALL goes to 1 sheet, which you can prove to yourself by running the attached code.&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods _all_ close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods csvall file='c:\temp\_3_tabulate_steps.csv';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=sashelp.class;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title '1) TABULATE for CLASS';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class age;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; table age all,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n pctn;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=sashelp.cars;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title '2) TABULATE for CARS';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class type;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; table type all,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n pctn;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=sashelp.shoes;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title '3) TABULATE for SHOES';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class product;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; table product all,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n pctn;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods csvall close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 22:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180400#M45975</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-08-29T22:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Multi sheet csv file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180401#M45976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="149872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: While you can't create a csv file with multiple sheets, you can create a workbook that contains a macro that, when clicked, will create a multi-sheet workbook from the csv files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I stole the following code/method from a post at: &lt;A href="http://www.excelforum.com/excel-programming-vba-macros/504512-import-multiple-csv-files-into-current-workbook-as-separate-sheets.html" title="http://www.excelforum.com/excel-programming-vba-macros/504512-import-multiple-csv-files-into-current-workbook-as-separate-sheets.html"&gt;Import multiple csv files into current workbook as separate sheets [SOLVED]&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you place all of your csv files in one directory, create a workbook, insert a text box with some instruction (e.g., click here to view the files) and assign the following macro to it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-style: inherit; font-weight: inherit;"&gt;Sub LoopFiles()&lt;BR /&gt;&amp;nbsp; Dim strDir As String, strFileName As String&lt;BR /&gt;&amp;nbsp; Dim wbSourceBook As Workbook&lt;BR /&gt;&amp;nbsp; Dim wbWriteBook As Workbook&lt;BR /&gt;&amp;nbsp; Dim wsWriteSheet As Worksheet&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; strDir = "C:\myCSVfiles\" 'specify folder to search&lt;BR /&gt;&amp;nbsp; strFileName = Dir(strDir &amp;amp; "*.csv")&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Set wbWriteBook = Workbooks.Add&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Do While strFileName &amp;lt;&amp;gt; ""&lt;BR /&gt;&amp;nbsp; Set wbSourceBook = Workbooks.Open(strDir &amp;amp; strFileName)&lt;BR /&gt;&amp;nbsp; Set wsWriteSheet = wbWriteBook.Sheets.Add&lt;BR /&gt;&amp;nbsp; wsWriteSheet.Name = strFileName&lt;BR /&gt;&amp;nbsp; wbSourceBook.Sheets(1).UsedRange.Copy wsWriteSheet.Range("A1")&lt;BR /&gt;&amp;nbsp; wbSourceBook.Close False&lt;BR /&gt;&amp;nbsp; strFileName = Dir&lt;BR /&gt;&amp;nbsp; Loop&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Aug 2014 16:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180401#M45976</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-08-30T16:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Multi sheet csv file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180402#M45977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There aren't "multiple sheets" in a CSV file.&amp;nbsp; So, what is it you want to do?&amp;nbsp; Do you want to create multiple CSV files, then import them as multiple worksheets in an Excel workbook?&amp;nbsp; Or something else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use ODS Excel tagsets to create an Excel workbook (in somewhat bloated XML format) that contains multiple worksheets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 00:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180402#M45977</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2014-09-01T00:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Multi sheet csv file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180403#M45978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="active_link" href="http://blogs.sas.com/content/sasdummy/2014/08/29/experimenting-with-ods-excel-to-create-spreadsheets-from-sas/"&gt;http://blogs.sas.com/content/sasdummy/2014/08/29/experimenting-with-ods-excel-to-create-spreadsheets-from-sas/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 06:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multi-sheet-csv-file/m-p/180403#M45978</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-01T06:30:33Z</dc:date>
    </item>
  </channel>
</rss>

