<?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: call execute code export to sas file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797398#M287497</link>
    <description>&lt;P&gt;Generic approach:&lt;/P&gt;
&lt;P&gt;Add a FILE statement to the data step pointing to where you want to store the created program. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;File  "&amp;lt;your path goes here&amp;gt;\myprogramname.sas" ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace CALL EXECUTE with PUT to create the text. Depending on the details of your actual CALL EXECUTE syntax this may mean creating a long character variable and assigning a value to that and then Put to the file.&lt;/P&gt;
&lt;P&gt;With the picture you show, I would probably create several PUT statements instead of one for that call execute. But without Text to edit I can't provide an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the data step creating the text file you would execute it with an %include statement when you want to run it.&lt;/P&gt;
&lt;PRE&gt;%include  "&amp;lt;your path goes here&amp;gt;\myprogramname.sas" ;&lt;/PRE&gt;
&lt;P&gt;The path should start at a drive or mount point.&lt;/P&gt;
&lt;P&gt;I would also suggest checking the results of creating the file by opening in an editor to make sure it contains what you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Feb 2022 17:53:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-02-19T17:53:23Z</dc:date>
    <item>
      <title>call execute code export to sas file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797395#M287495</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I am running the below code by using &lt;SPAN class=""&gt;call&lt;/SPAN&gt; &lt;SPAN class=""&gt;execute.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN class=""&gt;is any options to print the code to external file which is exceuted by below code.&lt;/SPAN&gt;&lt;/FONT&gt;&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="raja777pharma_0-1645289970933.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68683iF7D9000CB88268BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="raja777pharma_0-1645289970933.png" alt="raja777pharma_0-1645289970933.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN class=""&gt;Thank you,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN class=""&gt;Vivek.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 17:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797395#M287495</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2022-02-19T17:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: call execute code export to sas file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797398#M287497</link>
      <description>&lt;P&gt;Generic approach:&lt;/P&gt;
&lt;P&gt;Add a FILE statement to the data step pointing to where you want to store the created program. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;File  "&amp;lt;your path goes here&amp;gt;\myprogramname.sas" ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace CALL EXECUTE with PUT to create the text. Depending on the details of your actual CALL EXECUTE syntax this may mean creating a long character variable and assigning a value to that and then Put to the file.&lt;/P&gt;
&lt;P&gt;With the picture you show, I would probably create several PUT statements instead of one for that call execute. But without Text to edit I can't provide an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the data step creating the text file you would execute it with an %include statement when you want to run it.&lt;/P&gt;
&lt;PRE&gt;%include  "&amp;lt;your path goes here&amp;gt;\myprogramname.sas" ;&lt;/PRE&gt;
&lt;P&gt;The path should start at a drive or mount point.&lt;/P&gt;
&lt;P&gt;I would also suggest checking the results of creating the file by opening in an editor to make sure it contains what you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 17:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797398#M287497</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-19T17:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: call execute code export to sas file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797410#M287507</link>
      <description>&lt;P&gt;Yikes.&lt;/P&gt;
&lt;P&gt;You are running a data _NULL_ step already.&amp;nbsp; So why not run a step to get the type of the variables listed your dataset added as variables in the data step and avoid having to use OPEN() and VARNUM() and VARTYPE()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to generate code to a file use the PUT statement.&amp;nbsp; Then you can use all of the power of the PUT statement including formats.&amp;nbsp; That will be much easier than your current code with STRIP() and IFC() function calls.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can run the file using %INCLUDE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally what is the code that are actually generate and run trying to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like if you have multiple VARIABLE from the same DATASET you are going to generate a separate PROC SQL step for each one.&amp;nbsp; You should be able to generate a single PROC SQL step for all datasets and a single SELECT statement for each DATASET.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 19:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/call-execute-code-export-to-sas-file/m-p/797410#M287507</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-19T19:47:54Z</dc:date>
    </item>
  </channel>
</rss>

