<?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: Exporting to Excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823032#M324985</link>
    <description>&lt;P&gt;Using ODS excel should solve your issue. &lt;BR /&gt;This forum post has a solution for you&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-excel-multiple-sheet/td-p/225377" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-excel-multiple-sheet/td-p/225377&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;The following refernces are also very helpful&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/nesug/nesug08/hw/hw01.pdf" target="_blank"&gt;https://www.lexjansen.com/nesug/nesug08/hw/hw01.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.mwsug.org/proceedings/2019/SP/MWSUG-2019-SP-072.pdf" target="_blank"&gt;https://www.mwsug.org/proceedings/2019/SP/MWSUG-2019-SP-072.pdf&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;You can google fro ODS excel and multisheet workbooks to find more resources.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2022 23:43:16 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2022-07-12T23:43:16Z</dc:date>
    <item>
      <title>Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823004#M324976</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I am able to export my SAS file to Excel when there is nothing else in the excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I try to create tables on new sheets from prior data exported from SAS and save it. The next time I run the program and then go to open the excel&amp;nbsp;it will give me an error. I have other excels that I have done this with before and it gives me no issues. Any advice?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ccaudillo100_1-1657656671372.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73251i2F9409D9F0FA5CEE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ccaudillo100_1-1657656671372.png" alt="ccaudillo100_1-1657656671372.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After I hit yes, then it tells me that someone else is in the file. When nobody else is using it and I had closed it prior.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 20:58:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823004#M324976</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-12T20:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823007#M324978</link>
      <description>&lt;P&gt;Please describe exactly how you are "exporting" data to Excel. Show the code if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are several approaches and some will lock a file not allowing you to access it until the process completes.&lt;/P&gt;
&lt;P&gt;Others aren't really intended to modify existing Excel files.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 20:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823007#M324978</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-12T20:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823013#M324980</link>
      <description>&lt;P&gt;I have attached what I could show in the code on the original post. Sorry for so much cut out. It does import from and export to a network drive&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 21:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823013#M324980</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-12T21:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823016#M324982</link>
      <description>&lt;P&gt;Please include the code in your reply (not in an attachment) by clicking on the "running man" icon and pasting the code into the window that appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, please show us the ENTIRE log for this export (all of it for the export, every single line of the export code, do not show us parts of the log of the export and not show us other parts of the log of the export) by clicking on the &amp;lt;/&amp;gt; icon and pasting the log into the window that appears.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 21:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823016#M324982</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-12T21:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823032#M324985</link>
      <description>&lt;P&gt;Using ODS excel should solve your issue. &lt;BR /&gt;This forum post has a solution for you&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-excel-multiple-sheet/td-p/225377" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-excel-multiple-sheet/td-p/225377&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;The following refernces are also very helpful&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/nesug/nesug08/hw/hw01.pdf" target="_blank"&gt;https://www.lexjansen.com/nesug/nesug08/hw/hw01.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.mwsug.org/proceedings/2019/SP/MWSUG-2019-SP-072.pdf" target="_blank"&gt;https://www.mwsug.org/proceedings/2019/SP/MWSUG-2019-SP-072.pdf&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;You can google fro ODS excel and multisheet workbooks to find more resources.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 23:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823032#M324985</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-07-12T23:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823093#M325012</link>
      <description>&lt;P&gt;I am showing what I can due to confidentiality reasons. If you cannot help that is fine, I just figured I would see if anyone had helpful advice.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options validvarname=v7;

proc import datafile= 
“File"
out= work.calls21
dbms= xlsx replace;
run;

proc import datafile= 
“File"
out= work.visits21
dbms= xlsx replace;
run;

proc import datafile= 
“File"
out= work.calls22
dbms= xlsx replace;
run;

proc import datafile= 
“File"
out= work.visits22
dbms= xlsx replace;
run;

proc import datafile= 
“File"
out= work.CallsFS
dbms= xlsx replace;
run;

proc sql; 
create table CallsFS1 as 
select 

from CallsFS ;
quit;


Data CallsFS2 (drop= xx1);
set CallsFS1;
if xx then xx;
if xx then xx; 
xx  = (xx1*1);
 if xx = "." then xx = 0;
Run;





proc sql; 
create table Calls21A as 
select 

	
from calls21 ; 

quit;



data Calls22A;

	set calls22;
	rename;
run;



proc sql; 
create table Calls22B as 
select 
	
from calls22A ; 
quit;



proc sql; 
create table Visits21A as 
select 
	
from Visits21 ; 

quit;


proc sql; 
create table Visits22A as 
select 
	 
from Visits22 ; 
quit;






proc sort data= Calls21A; by xx; run;
proc sort data= Calls22B; by xx; run;
proc sort data= Visits21A; by xx; run;
proc sort data= Visits22A; by xx; run;
proc sort data= CallsFS2; by xx; run;

data Visits(DROP= NULL);
length;
Merge Visits21A Visits22A;
Run;


data Calls (DROP= NULL);
length 
Merge Calls21A Calls22B;
Run;

data CallsFS2 (DROP= NULL);
length;
Set CallsFS2;

Run;


data RawData ;
 Format 
Merge  Visits Calls CallsFS2;
by xx;
Run;

data RawData1;
set RawData;
;
 run;


proc export data=RawData1
	outfile="xx\Public\VisitCall"
	dbms=xlsx
	Replace;
	Sheet="Raw Data";
Run;


proc export data=Visits
	outfile="xx\Public\VisitCall"
	dbms=xlsx
	Replace;
	Sheet="Visits Dynamics";
Run;

proc export data=Calls
	outfile=" xx\Public\VisitCall"
	dbms=xlsx
	Replace;
	Sheet="Calls";
Run;


proc export data= CallsFS
	outfile="xx\Public\VisitCall"
	dbms=xlsx
	Replace;
	Sheet="CallsFSOG";
Run;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 13:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823093#M325012</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-13T13:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823097#M325014</link>
      <description>&lt;P&gt;I tried this and it deletes any new tabs/designs I created once it is ran again. I just need to be able to create a table that it exports to its designated tabs and leaves other tabs alone&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 13:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823097#M325014</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-13T13:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823128#M325024</link>
      <description>&lt;P&gt;What I understand from your post is that whenever a data set is exported to an excel workbook, your previous sheets are gone.&lt;BR /&gt;I have taken the exports from your code and modified as follows. All the exported sheet be persist in the final.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myxlfile "/full_path_to_your_excel_file.xlsx";
proc export data=RawData1
	dbms=xlsx
	outfile=myxlfile Replace;
	Sheet="Raw Data";
Run;

proc export data=Visits
    dbms=xlsx
	outfile=myxlfile  
	Replace;
	Sheet="Visits Dynamics";
Run;

proc export data=Calls
    dbms=xlsx
	outfile=myxlfile  
	Replace;
	Sheet="Calls";
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In case of an error please post the code and logs.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 14:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823128#M325024</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-07-13T14:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823191#M325042</link>
      <description>&lt;P&gt;It exported well the first time. But when I added a blank sheet in, saved, and closed it, I reran the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately the excel is still giving me the pop up of&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"We found a problem with some content in 'file.xlsx'. Do you want us to try to recover as much as we can? If you&amp;nbsp; trust the source of this workbook, Click Yes."&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 18:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823191#M325042</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-13T18:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823207#M325048</link>
      <description>&lt;P&gt;This typically does not happen when files are exported as xlsx. &lt;BR /&gt;Have a look at this &lt;A href="https://answers.microsoft.com/en-us/msoffice/forum/all/file-is-corrupt-and-cannot-be-opened-in-excel-2016/3e378431-83c6-474e-a852-eaea3bb802a8" target="_blank"&gt;https://answers.microsoft.com/en-us/msoffice/forum/all/file-is-corrupt-and-cannot-be-opened-in-excel-2016/3e378431-83c6-474e-a852-eaea3bb802a8&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 19:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823207#M325048</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-07-13T19:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting to Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823315#M325080</link>
      <description>I will look into it! Thank you</description>
      <pubDate>Thu, 14 Jul 2022 14:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-to-Excel/m-p/823315#M325080</guid>
      <dc:creator>ccaudillo100</dc:creator>
      <dc:date>2022-07-14T14:00:11Z</dc:date>
    </item>
  </channel>
</rss>

