<?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: SAS: Export more dataset in one excel sheet with two columns space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750382#M236029</link>
    <description>&lt;P&gt;One (messy) way if you really need to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PRINT;
  if _N_&amp;lt;=NOBS1 then set SASHELP.CLASS nobs=NOBS1;
  BL1=' '; BL2=' ';    label BL1='00'x BL2='00'x;
  if _N_&amp;lt;=NOBS2 then set SASHELP.AIR nobs=NOBS2;
  output;
  call missing (of _ALL_);
run;
                                   
ods excel file='%temp%\file.xls';
proc print noobs label; run;
ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisNZ_0-1624599456043.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60738iD57668FF9728ECE9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisNZ_0-1624599456043.png" alt="ChrisNZ_0-1624599456043.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jun 2021 05:39:28 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-06-25T05:39:28Z</dc:date>
    <item>
      <title>SAS: Export more dataset in one excel sheet with two columns space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750108#M235864</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I am in trouble with the following question: In general, I generate a lot of excel folder with SAS and I export each single dataset to another excel file, in order to have a lot of dataset with 2 columns that is the space between each dataset.&lt;/P&gt;&lt;P&gt;There exist a command in SAS that give to me a single excel file, considering a lot of dataset? For example, if I have 3 dataset in SAS, is possible to have the following output, with some command, as the picture below?&lt;/P&gt;&lt;P&gt;My desired output:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://i.stack.imgur.com/w29ix.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 07:21:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750108#M235864</guid>
      <dc:creator>JohnMidd1111</dc:creator>
      <dc:date>2021-06-24T07:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Export more dataset in one excel sheet with two columns space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750128#M235879</link>
      <description>&lt;P&gt;First a minor editorial comment: Gaack!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might make sense to have the datasets on separate sheets. The proposed layout, which shows &lt;STRONG&gt;no&lt;/STRONG&gt; information about what any of the groups of columns would mean, such as the source data set what it should be used for is just asking for trouble. Almost worse is the possibility of repeated variable names. So what do you do when you get an Excel sheet that has 3 columns named "Name"? Do you know what sort of "name" any particular column represents? Remember you have not included any information that shows the source of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Won't work with Proc Export in general.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please describe exactly how you expect to use that exported data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use a LIBNAME pointing to an Excel file and Copy data sets (with different names) to different sheets.&lt;/P&gt;
&lt;P&gt;Or use ODS EXCEL to with Proc Print (or other output generating procedure). By default each table "printed" would go to a different sheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code to accomplish such a thing is likely to be somewhat fragile, i.e. easy to break and not generate "desired" output.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 09:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750128#M235879</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-24T09:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Export more dataset in one excel sheet with two columns space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750142#M235887</link>
      <description>Hi, thanks for the answer. I need to have the following structure since I need to generate 10 dataset in 5 different pages, for some analysis that I need to do at work.&lt;BR /&gt;So for this reason, in general, I create each single dataset and with copy and paste I generate my result: 10 dataset (10 for each sheet), and after that I take each sheet for some analysis that are very very long.&lt;BR /&gt;&lt;BR /&gt;So there exist in your opinion something useful to have an output similar to the picture?</description>
      <pubDate>Thu, 24 Jun 2021 10:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750142#M235887</guid>
      <dc:creator>JohnMidd1111</dc:creator>
      <dc:date>2021-06-24T10:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Export more dataset in one excel sheet with two columns space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750226#M235928</link>
      <description>&lt;P&gt;I am having a very hard time imagining any analysis that &lt;STRONG&gt;requires&lt;/STRONG&gt; that layout.&lt;/P&gt;
&lt;P&gt;Please describe the analysis.&lt;/P&gt;
&lt;P&gt;It might be easier to do in SAS before any export.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 14:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750226#M235928</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-24T14:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: Export more dataset in one excel sheet with two columns space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750382#M236029</link>
      <description>&lt;P&gt;One (messy) way if you really need to do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PRINT;
  if _N_&amp;lt;=NOBS1 then set SASHELP.CLASS nobs=NOBS1;
  BL1=' '; BL2=' ';    label BL1='00'x BL2='00'x;
  if _N_&amp;lt;=NOBS2 then set SASHELP.AIR nobs=NOBS2;
  output;
  call missing (of _ALL_);
run;
                                   
ods excel file='%temp%\file.xls';
proc print noobs label; run;
ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChrisNZ_0-1624599456043.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60738iD57668FF9728ECE9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisNZ_0-1624599456043.png" alt="ChrisNZ_0-1624599456043.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 05:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Export-more-dataset-in-one-excel-sheet-with-two-columns/m-p/750382#M236029</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-06-25T05:39:28Z</dc:date>
    </item>
  </channel>
</rss>

