<?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: Wrting cells from PROC FREQ into specific cells in an Excel template in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869654#M343512</link>
    <description>Ksharp, I owe you a steak dinner, or at least a drink! Your solution almost​ worked. I made a few simple trial&amp;amp;error modifications and it works like a charm. Thanks for the lead-in!&lt;BR /&gt;&lt;BR /&gt;proc summary data=Table1 ;&lt;BR /&gt;class sex;&lt;BR /&gt;output out=SANDBOX.B1A;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;[cid:4eab63a2-af30-43d2-9250-91fcf5d23b1f]&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set SANDBOX.B1A;&lt;BR /&gt;if missing(sex) then call symputx('all',_freq_);&lt;BR /&gt;else call symputx(sex,_freq_);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;libname x excel 'C:\Users\...\FINAL_Table_TEST.xlsx' scan_text=no getnames=no;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;update x.'Table$'n set f2="&amp;amp;all" where (f1)='all students';&lt;BR /&gt;update x.'Table$'n set f2="&amp;amp;F" where (f1)='Females' ;&lt;BR /&gt;update x.'Table$'n set f2="&amp;amp;M" where (f1)='Males';&lt;BR /&gt;quit;&lt;BR /&gt;libname x clear;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[cid:d441740a-9564-4311-b90e-3cc2ce0eda66]&lt;BR /&gt;</description>
    <pubDate>Thu, 13 Apr 2023 19:51:30 GMT</pubDate>
    <dc:creator>MADPhD</dc:creator>
    <dc:date>2023-04-13T19:51:30Z</dc:date>
    <item>
      <title>Wrting cells from PROC FREQ into specific cells in an Excel template</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869488#M343422</link>
      <description>&lt;P&gt;I have a Proc Freq that produces a column of 3 numbers (Column name 'N', row 1 name is 'All', row 2 name is 'Female', row 3 name is 'Male'.&amp;nbsp; Column N contains headcounts.&amp;nbsp; The dataset name is B1A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MADPhD_1-1681338423838.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82654iB55A33D4B854821E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MADPhD_1-1681338423838.png" alt="MADPhD_1-1681338423838.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to write these three numbers to an external excel file called 'Final_Table_Test.xlsx; tab name is .Table'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Excel file is: filename DDE "excel|C:\...\2020-2021 TABLE\[FINAL_Table_TEST.xlsx]Table!R6C3:R8C3".&lt;/P&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="MADPhD_2-1681338540051.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82655iFF9D4930FB3B951C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MADPhD_2-1681338540051.png" alt="MADPhD_2-1681338540051.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At one time (years ago), I I wrote something like this that actually did this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;set SANDBOX.B1A;&lt;BR /&gt;INFILE 'B1A';&lt;BR /&gt;input N;&lt;BR /&gt;FILE FINAL_Table_TEST;&lt;BR /&gt;PUT CELL1 CELL2 CELL3;&lt;BR /&gt;RUN;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, no manipulation I have tried works.&amp;nbsp; I get the following error:&lt;/P&gt;&lt;P&gt;ERROR: Physical file does not exist, C:\WINDOWS\system32\B1A.&lt;BR /&gt;ERROR: Insufficient authorization to access C:\WINDOWS\system32\FINAL_TABLE_TEST.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ides?&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, 12 Apr 2023 22:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869488#M343422</guid>
      <dc:creator>MADPhD</dc:creator>
      <dc:date>2023-04-12T22:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Wrting cells from PROC FREQ into specific cells in an Excel template</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869489#M343423</link>
      <description>DDE was deprecated by Windows a while ago due to security concerns. You can re-enable it in Excel but you should check with your IT Security team first. &lt;BR /&gt;&lt;BR /&gt;My recommendation would be to export the data to a new sheet that SAS can overwrite to each time, and then link those cells to the location you want instead. I haven't tried this in a while but theoretically it worked a few years ago &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 12 Apr 2023 22:40:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869489#M343423</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-04-12T22:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Wrting cells from PROC FREQ into specific cells in an Excel template</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869556#M343454</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=sashelp.heart ;
class sex;
output out=have ;
run;
data _null_;
set have;
if missing(sex) then call symputx('all',_freq_);
else call symputx(sex,_freq_);
run;




libname x excel 'c:\temp\FINAL_Table_TEST.xlsx' scan_text=no getnames=no; 
proc sql;
update x.'sheet1$'n
set f2="&amp;amp;all"
where lowcase(f1)='all students'
;
update x.'sheet1$'n
set f2="&amp;amp;female"
where lowcase(f1)='females'
;
update x.'sheet1$'n
set f2="&amp;amp;male"
where lowcase(f1)='males'
;
quit;
libname x clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1681386251379.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82662i54E6F18B4F1F473E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1681386251379.png" alt="Ksharp_0-1681386251379.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 11:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869556#M343454</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-04-13T11:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Wrting cells from PROC FREQ into specific cells in an Excel template</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869654#M343512</link>
      <description>Ksharp, I owe you a steak dinner, or at least a drink! Your solution almost​ worked. I made a few simple trial&amp;amp;error modifications and it works like a charm. Thanks for the lead-in!&lt;BR /&gt;&lt;BR /&gt;proc summary data=Table1 ;&lt;BR /&gt;class sex;&lt;BR /&gt;output out=SANDBOX.B1A;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;[cid:4eab63a2-af30-43d2-9250-91fcf5d23b1f]&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set SANDBOX.B1A;&lt;BR /&gt;if missing(sex) then call symputx('all',_freq_);&lt;BR /&gt;else call symputx(sex,_freq_);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;libname x excel 'C:\Users\...\FINAL_Table_TEST.xlsx' scan_text=no getnames=no;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;update x.'Table$'n set f2="&amp;amp;all" where (f1)='all students';&lt;BR /&gt;update x.'Table$'n set f2="&amp;amp;F" where (f1)='Females' ;&lt;BR /&gt;update x.'Table$'n set f2="&amp;amp;M" where (f1)='Males';&lt;BR /&gt;quit;&lt;BR /&gt;libname x clear;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[cid:d441740a-9564-4311-b90e-3cc2ce0eda66]&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Apr 2023 19:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869654#M343512</guid>
      <dc:creator>MADPhD</dc:creator>
      <dc:date>2023-04-13T19:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Wrting cells from PROC FREQ into specific cells in an Excel template</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869760#M343562</link>
      <description>Hope one day I could have that "steak dinner" .    *^_^*</description>
      <pubDate>Fri, 14 Apr 2023 11:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrting-cells-from-PROC-FREQ-into-specific-cells-in-an-Excel/m-p/869760#M343562</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-04-14T11:52:29Z</dc:date>
    </item>
  </channel>
</rss>

