<?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 generate sas code using recursive join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108844#M22640</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A-B-D-E and A-C-E both are possible, especially when one parent can have multiple child in the process, which represents parallel execution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Aug 2013 15:21:14 GMT</pubDate>
    <dc:creator>ZRick</dc:creator>
    <dc:date>2013-08-13T15:21:14Z</dc:date>
    <item>
      <title>how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108837#M22633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp; I need to automatically generate a sas code that dynamically&lt;BR /&gt;generate include statement based on beginning and ending job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;/*pid is the parent id*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; dependency;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;length&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; job $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;20&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; id pid job $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;1 0&amp;nbsp; import_data.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;2 1&amp;nbsp; check.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;3 2&amp;nbsp; sort.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;4 2&amp;nbsp; sum.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;/*new job is: */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; job_run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; start end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;1 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;/*end result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;generate new code that contains:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;include "import_data.sas";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;include "check.sas";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;include "sum.sas";&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;/* another job */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; job_run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; start end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;2 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;/*end result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;generate new code that contains:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;include "check.sas";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;include "sort.sas";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 17:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108837#M22633</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2013-08-12T17:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108838#M22634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will work if ids are unique in dataset dependency :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data dependency (index=(id/unique));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;length job $20;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input id pid job $;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; 1 0&amp;nbsp; import_data.sas&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; 2 1&amp;nbsp; check.sas&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; 3 2&amp;nbsp; sort.sas&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; 4 2&amp;nbsp; sum.sas&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data job_run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input start end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; 1 4&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;length cmd $1000;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set job_run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;pid = end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do until(id=start);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = pid;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set dependency key=id/unique;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd = catt('%include "', job, '";', cmd);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;call symputx("job", cmd);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%job;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 18:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108838#M22634</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-08-12T18:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108839#M22635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do have situation, parent id is not unique, will this still work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, possible to generate a sas code, instead of a macro variable representing series of jobs?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 20:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108839#M22635</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2013-08-12T20:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108840#M22636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PG's code won't work as-is for duplicate observations of PID. Try something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;length cmd $1000;&lt;BR /&gt;set job_run;&lt;BR /&gt;&amp;nbsp; do id = start to end ;&lt;BR /&gt;&amp;nbsp; set dependency key=id/unique;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd = catt('%include "', job, '";', cmd);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;call symputx("job", cmd);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%put Generated SAS code is: "&amp;amp;job";&lt;/P&gt;&lt;P&gt;&amp;amp;job;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 22:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108840#M22636</guid>
      <dc:creator>Fugue</dc:creator>
      <dc:date>2013-08-12T22:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108841#M22637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I come up with, but still have two missing pieces:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, how do I create jrun dataset based on dependency dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, how do I finish the following code without error? &lt;/P&gt;&lt;P&gt;I did it using put statement in the data _&lt;EM&gt;null&lt;/EM&gt;_; in the data step inside a macro do loop. &lt;/P&gt;&lt;P&gt;It says I use put wrong. &lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;I use %put, but it outputs to the log. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;I don't know&amp;nbsp; how&amp;nbsp; to output a sas file using do loop macro.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; jrun;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;length&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; job_nm $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;20&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; jid job_nm $;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;1 import_data.sas&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;2 check.sas&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: #ffffc0; color: black; font-family: 'Courier New';"&gt;4 sum.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; r&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;un&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%macro p&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;_run(dsn);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;DATA _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; FILE &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;"~/p_run_&amp;amp;dsn.sas"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &lt;BR /&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select count(distinct jid) into: jnm_nbr&amp;nbsp; from &amp;amp;dsn ;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select job_nm into: jnm1 - :jnm%&lt;STRONG&gt;&lt;EM&gt;trim&lt;/EM&gt;&lt;/STRONG&gt;(%&lt;STRONG&gt;&lt;EM&gt;left&lt;/EM&gt;&lt;/STRONG&gt;(&amp;amp;jnm_nbr))&lt;BR /&gt;from &amp;amp;dsn ;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; _user_;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;BR /&gt;quit;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; n=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &amp;amp;jnm_nbr;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;PUT &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;"%runsasfile (spawning,&amp;amp;&amp;amp;jnm&amp;amp;n);"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;put &lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;""&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;RUN;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;%&lt;STRONG&gt;&lt;EM&gt;p_run&lt;/EM&gt;&lt;/STRONG&gt;(jrun);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;/*result should look like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;in the code, p_run_jrun.sas, it has&lt;BR /&gt;these lines:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;%runsasfile (spawning,import_data.sas);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;%runsasfile (spawning, check.sas);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;%runsasfile (spawning, sum.sas);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: green; font-family: 'Courier New';"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 00:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108841#M22637</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2013-08-13T00:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108842#M22638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"...possible to generate a sas code..."&lt;/P&gt;&lt;P&gt;You can write the generated SAS code to an external file and then include this file for execution as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*pid is the parent id*/&lt;BR /&gt;data dependency;&lt;BR /&gt;&amp;nbsp; length job $20;&lt;BR /&gt;&amp;nbsp; input id pid job $;&lt;BR /&gt;&amp;nbsp; cards;&lt;BR /&gt;1 0&amp;nbsp; import_data.sas&lt;BR /&gt;2 1&amp;nbsp; check.sas&lt;BR /&gt;3 2&amp;nbsp; sort.sas&lt;BR /&gt;4 2&amp;nbsp; sum.sas&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*new job is: */&lt;BR /&gt;data job_run;&lt;BR /&gt;&amp;nbsp; input start end;&lt;BR /&gt;&amp;nbsp; cards;&lt;BR /&gt;1 4&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create view v_jobs as&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select d.job&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dependency d, job_run j&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where d.pid between j.start and j.end&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by d.pid, d.id&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create SAS source code */&lt;BR /&gt;filename codegen temp;&lt;BR /&gt;data _null_;&lt;BR /&gt;/*&amp;nbsp; file codegen;*/&lt;BR /&gt;&amp;nbsp; file print;&lt;BR /&gt;&amp;nbsp; set v_jobs;&lt;BR /&gt;&amp;nbsp; put '%include "' job +(-1) '" / source2 ;' ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* execute generated source code */&lt;BR /&gt;/*%include codegen;*/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 01:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108842#M22638</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-08-13T01:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108843#M22639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand in what circumstance a job dependency can have duplicate IDs. What sequence would you want when an ID has more than one PID. For instance :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dependency&lt;BR /&gt;&lt;STRONG&gt;ID PID job&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1 0 A&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2 1 B&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;3 1 C&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;3 2 D&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;4 3 E&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Job_run&lt;BR /&gt;&lt;STRONG&gt;Start End&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1 4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you want &lt;STRONG&gt;A-B-D-E&lt;/STRONG&gt; or &lt;STRONG&gt;A-C-E&lt;/STRONG&gt; ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 02:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108843#M22639</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-08-13T02:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108844#M22640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A-B-D-E and A-C-E both are possible, especially when one parent can have multiple child in the process, which represents parallel execution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108844#M22640</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2013-08-13T15:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108845#M22641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great logic, I like it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing I don't understand:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put '%include "' job +(-1) '" / source2 ;' ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is job + (-1)?&lt;/P&gt;&lt;P&gt;Why do you use single quote and double quote?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108845#M22641</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2013-08-13T15:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108846#M22642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want the code written to the temporary file to be&lt;/P&gt;&lt;P&gt;%include "&amp;lt;jobname&amp;gt;" / source2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to write the double quotes to the file I need to quote them with single quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The +(-1) moves the pointer backwards one column. Else the resulting string would have a blank between the jobname and the double quote.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 01:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108846#M22642</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-08-14T01:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate sas code using recursive join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108847#M22643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way:&lt;/P&gt;&lt;P&gt;If you really want to go for parallel execution if the parent is the same the you would need to generate code using statements like "SYSTASK" together with "WAITFOR" instead of a couple of "%include".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using "%include" for scheduling has also the disadvantage that all included .sas programs run as a single program sharing the same workspace. This can result in some unexpected issues, eg. if a previous job creates work tables or macro variables which influence the behaviour of a subsequent job. Using systask (or x command, or rsubmit,...) to execute each job in its own environment could be beneficial.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 01:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-sas-code-using-recursive-join/m-p/108847#M22643</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-08-14T01:18:10Z</dc:date>
    </item>
  </channel>
</rss>

