<?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: How to fill excel formula in SAS DDE? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-excel-formula-in-SAS-DDE/m-p/739360#M230747</link>
    <description>&lt;P&gt;Since Microsoft is no longer supporting DDE and other software can interfere with the communications channels I would suggest using a different approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a SAS add in called Integration with Microsoft Office that might be a tad more robust going forward.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure that SAS can read the actual formula as the tools I've used want to get the value that would be resolved from that function in the spread sheet.&lt;/P&gt;
&lt;P&gt;You can use TAGATTR style overrides in some procedures that will write functions into ODS EXCEL or ODS TAGSETS.EXCELXP output but not my personal strength.&lt;/P&gt;</description>
    <pubDate>Wed, 05 May 2021 22:02:22 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-05-05T22:02:22Z</dc:date>
    <item>
      <title>How to fill excel formula in SAS DDE?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-excel-formula-in-SAS-DDE/m-p/739323#M230733</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using DDE to import excel files and overwriting them. I found that all excel formulas are gone after DDE re-write them. I see there is a way to put formula in excel by using DDE, something like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dliang_0-1620242964162.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59070i63129F6D6DD1371A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dliang_0-1620242964162.png" alt="dliang_0-1620242964162.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But I was using the DDE macros, I do not know where I should put this code. Can someone please give me some advices? See my DDE code below.&lt;/P&gt;&lt;P&gt;%let stufilein=U:\Reports and Data\TN Reporting;&lt;BR /&gt;%let stufileout=U:\Reports and Data\TN Reporting\TN_DL\Test;&lt;BR /&gt;%MACRO OPENxlsx(FOLDER=,IN=);&lt;/P&gt;&lt;P&gt;%LET FIL=;&lt;BR /&gt;DATA _null_;&lt;BR /&gt;LENGTH FILE $300.;&lt;BR /&gt;FILE="'&amp;amp;STUFILEin\&amp;amp;folder.&amp;amp;in.'";&lt;BR /&gt;FILE="'"!!TRIM(LEFT(TRANWRD(FILE,"'",'"')))!!"'";&lt;BR /&gt;CALL SYMPUT ("FIL",TRIM(LEFT(FILE)));&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;options noxwait noxsync;&lt;BR /&gt;x &amp;amp;fil.;&lt;BR /&gt;data _null_;&lt;BR /&gt;filename commands dde "Excel|system";&lt;/P&gt;&lt;P&gt;/*run;*/&lt;BR /&gt;%MEND OPENxlsx;&lt;/P&gt;&lt;P&gt;/*********************************************************************************/&lt;BR /&gt;/* TO SAVE ACTIVE xlsx FILE UNDER SPECIFIC FOLDERS AND QUIT EXCEL */&lt;BR /&gt;/*********************************************************************************/&lt;BR /&gt;%MACRO CLOSExlsx(out=,quit=0);&lt;BR /&gt;%LET FIL=;&lt;BR /&gt;DATA _null_;&lt;BR /&gt;LENGTH FILE $300.;&lt;BR /&gt;FILE="[save.as('&amp;amp;STUFILEout.\&amp;amp;out.')]";&lt;BR /&gt;FILE="'"!!TRIM(LEFT(TRANWRD(FILE,"'",'"')))!!"'";&lt;BR /&gt;CALL SYMPUT ("FIL",TRIM(LEFT(FILE)));&lt;BR /&gt;RUN;&lt;BR /&gt;%PUT &amp;amp;FIL=;&lt;BR /&gt;data _null_;&lt;BR /&gt;file commands;&lt;BR /&gt;put &amp;amp;fil.;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;put '[CLOSE()]';&lt;BR /&gt;%IF &amp;amp;quit=0 %then %do;&lt;BR /&gt;put '[QUIT()]';&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;BR /&gt;filename commands clear;&lt;BR /&gt;%END;&lt;BR /&gt;%IF &amp;amp;quit=1 %then %do;&lt;BR /&gt;run;&lt;BR /&gt;%END;&lt;BR /&gt;%MEND CLOSExlsx;&lt;/P&gt;&lt;P&gt;%OPENxlsx(FOLDER=,IN=ER_IP_TN_XX_YYYYMMDD_NEW_NEW.xlsm); /* Open the Excel template*/&lt;BR /&gt;option missing="" ;&lt;/P&gt;&lt;P&gt;/* First dataset is output in a range starting at row 4 column 6 and ending at row 4 column 6*/&lt;BR /&gt;filename TAB DDE "EXCEL|[ER_IP_TN_XX_YYYYMMDD_NEW_NEW.xlsm]TN ER &amp;amp; IP 24 Log!R4C1:R50C70";&lt;BR /&gt;filename xlcmds DDE "EXCEL|SYSTEM";&lt;BR /&gt;data _null_; /* Data step to output the data in the Excel file */&lt;BR /&gt;set nonarchive_&amp;amp;&amp;amp;initial&amp;amp;m.;&lt;BR /&gt;file TAB notab lrecl=7000;&lt;/P&gt;&lt;P&gt;PUT PATIENT_FIRST_NAME '09'x&lt;BR /&gt;PATIENT_LAST_NAME '09'x&lt;BR /&gt;DOB '09'x&lt;BR /&gt;TDOC_CHAR '09'x&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;filename TAB DDE "EXCEL|[ER_IP_TN_XX_YYYYMMDD_NEW_NEW.xlsm]Archive!R4C1:R200C70";&lt;BR /&gt;filename xlcmds DDE "EXCEL|SYSTEM";&lt;BR /&gt;data _null_; /* Data step to output the data in the Excel file */&lt;BR /&gt;set archive_&amp;amp;&amp;amp;initial&amp;amp;m.;&lt;BR /&gt;file TAB notab lrecl=7000;&lt;/P&gt;&lt;P&gt;PUT PATIENT_FIRST_NAME '09'x&lt;BR /&gt;PATIENT_LAST_NAME '09'x&lt;BR /&gt;DOB '09'x&lt;BR /&gt;TDOC_CHAR '09'x&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%CLOSExlsx(OUT= &amp;amp;&amp;amp;source&amp;amp;m.);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/*%end;*/&lt;BR /&gt;%end;&lt;BR /&gt;%mend reports;&lt;BR /&gt;%reports;&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;</description>
      <pubDate>Wed, 05 May 2021 19:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-excel-formula-in-SAS-DDE/m-p/739323#M230733</guid>
      <dc:creator>dliang</dc:creator>
      <dc:date>2021-05-05T19:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill excel formula in SAS DDE?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-excel-formula-in-SAS-DDE/m-p/739360#M230747</link>
      <description>&lt;P&gt;Since Microsoft is no longer supporting DDE and other software can interfere with the communications channels I would suggest using a different approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a SAS add in called Integration with Microsoft Office that might be a tad more robust going forward.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure that SAS can read the actual formula as the tools I've used want to get the value that would be resolved from that function in the spread sheet.&lt;/P&gt;
&lt;P&gt;You can use TAGATTR style overrides in some procedures that will write functions into ODS EXCEL or ODS TAGSETS.EXCELXP output but not my personal strength.&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 22:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-excel-formula-in-SAS-DDE/m-p/739360#M230747</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-05T22:02:22Z</dc:date>
    </item>
  </channel>
</rss>

