<?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: Emailing Excel attachment SAS EG5.1 Error in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331500#M22013</link>
    <description>Hi Kurt, thanks a lot for the help.</description>
    <pubDate>Fri, 10 Feb 2017 13:43:09 GMT</pubDate>
    <dc:creator>vannesslee</dc:creator>
    <dc:date>2017-02-10T13:43:09Z</dc:date>
    <item>
      <title>Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331491#M22010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to export an excel file in a&amp;nbsp;SAS project where&amp;nbsp;I had generated the output. However, an error prompted out&amp;nbsp;saying that the file is in use. Any idea how to solve this error as&amp;nbsp;the file was not being opened by me when I&amp;nbsp;am&amp;nbsp;running the project. Thanks very much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below shows&amp;nbsp; the coding which I am using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;data_check&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;trading_dt=today()-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;filedate = put(trading_dt, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;yymmddn8.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put trading_dt &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;put filedate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;call symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'trading_dt'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, trading_dt);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;call symput(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'filedate'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, filedate);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;select count(*) into :cnt&lt;/P&gt;&lt;P&gt;from WORK.WET_REP_TXN ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;cnt ne &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;ODS html file=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'\\10.64.23.39\Users\88094701\WET_REP_txn.xls'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; STYLE=minimal;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;proc print data=WET_REP_TXN noobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp close;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;FILENAME alert EMAIL from=(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"to_me@hotmail.com"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;to=(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"&lt;FONT color="#800080" face="Courier New"&gt;to_me@hotmail.com&lt;/FONT&gt;"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Subject = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Generated - storage.customer &amp;amp;filedate "&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;attach=(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"\\10.64.23.39\Users\88094701\WET_REP_txn.xls"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; content_type=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"application/vnd.ms-excel"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;file alert;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"storage.customer is ready"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;data_check&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13427i1EEE34B6DCE032F7/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="error.png" title="error.png" /&gt;</description>
      <pubDate>Fri, 10 Feb 2017 13:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331491#M22010</guid>
      <dc:creator>vannesslee</dc:creator>
      <dc:date>2017-02-10T13:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331492#M22011</link>
      <description>&lt;P&gt;This is the source of your problem:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS html file='\\10.64.23.39\Users\88094701\WET_REP_txn.xls' STYLE=minimal ;

......


ods tagsets.excelxp close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You open one ODS destination, but close another, so the xls file is kept open.&lt;/P&gt;
&lt;P&gt;An it is EXTREMELY bad style to use ods html with an xls filename extension. If you create HTML, use .html as extension. If, OTOH, you use tagsets.excelxp, use .xml as the extension, as that aligns with the content.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 13:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331492#M22011</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-10T13:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331496#M22012</link>
      <description>&lt;P&gt;Just to add to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;there, do you think email is the best medium for sending what could be sensitive and possibly large datafiles? &amp;nbsp;If they are reports (and you wouldn't be using a bad data medium to convey data would you), then have some sort of secure reporting environment where you reports are published for authorised users to login and view, you can then send them an email when there is new files. &amp;nbsp;If you are doing a data transfer, then use a good data medium, CSV/XML etc., and use a secure portal to upload data to, then they can log in and download the data securely.&lt;/P&gt;
&lt;P&gt;Note, your email client will likely have size of email restrictions in place that will prevent you frm sending large files.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 13:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331496#M22012</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-10T13:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331500#M22013</link>
      <description>Hi Kurt, thanks a lot for the help.</description>
      <pubDate>Fri, 10 Feb 2017 13:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331500#M22013</guid>
      <dc:creator>vannesslee</dc:creator>
      <dc:date>2017-02-10T13:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331503#M22014</link>
      <description>Hi there mate, I would definitely say that sending outputs through emails aren't the best and recommended way because of the security and possibly large files issue. However, the output which I am working on has no output most of the day (daily run) and maximum of 5 outputs daily.&lt;BR /&gt;&lt;BR /&gt;Out of the topic question, do you know any SAS EG course which a beginner can attend so that they would be able to write a coding similar to the above?</description>
      <pubDate>Fri, 10 Feb 2017 13:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331503#M22014</guid>
      <dc:creator>vannesslee</dc:creator>
      <dc:date>2017-02-10T13:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331525#M22017</link>
      <description>&lt;P&gt;SAS EG training tends to cover how to use the tool, mainly the point-and-click tasks and query builder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To cover SAS coding you're better off looking at the "SAS Programming" series of courses. I believe that at least the first one is free on the SAS website.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331525#M22017</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-02-10T14:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331526#M22018</link>
      <description>&lt;P&gt;Alternately, I'd be happy to work with and tutor your folks, for a small fee!&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331526#M22018</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-02-10T14:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing Excel attachment SAS EG5.1 Error</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331535#M22022</link>
      <description>&lt;P&gt;One thing that helps greatly on the path to better coding is adapting a solid, consistent, visual coding style that makes code easier to read and identify logical units.&lt;/P&gt;
&lt;P&gt;Consider these slight changes to your original code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro data_check;

data _null_;
  trading_dt = today() - 2;
  filedate = put(trading_dt,yymmddn8.);
  put trading_dt date9.;
  put filedate;
  call symput('trading_dt',trading_dt);
  call symput('filedate',filedate);
run;

proc sql noprint;
  select
    count(*) into :cnt
    from WORK.WET_REP_TXN
  ;
quit;

%if &amp;amp;cnt ne 0 %then %do;

ods tagsets.excelxp file='\\10.64.23.39\Users\88094701\WET_REP_txn.xml' style=minimal;

proc print data=WET_REP_TXN noobs;
run;

ods tagsets.excelxp close;

filename alert email
  from=("to_me@hotmail.com")
  to=("to_me@hotmail.com")
  subject = "Generated - storage.customer &amp;amp;filedate "
  attach=("\\10.64.23.39\Users\88094701\WET_REP_txn.xml" content_type="application/vnd.ms-excel")
;

data _null_;
  file alert;
  put "storage.customer is ready";
run;

%end;

%mend;

%data_check;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The details of such coding style are up to you (how many columns used for each indentation etc), but visually pleasing code makes for faster working and easier detection of logical/semantic mistakes.&lt;/P&gt;
&lt;P&gt;Keep in mind that someone has to make sense of your code someday, and most of the time that someone will be you, so be good to your future self!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Emailing-Excel-attachment-SAS-EG5-1-Error/m-p/331535#M22022</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-10T15:01:02Z</dc:date>
    </item>
  </channel>
</rss>

