<?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 How can I use a single program to run multiple data sets? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28718#M6705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Better to have the sampling produce one data set, with a variable to indicate the sample number. Then it's as simple as adding a BY statement to the PROC LOGISTIC step.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;bncoxuk wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The random sampling created 10 datasets. For each dataset, I will need to run the same code as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC LOGISTIC DATA=work.data01;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLASS age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MODEL status=age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT OUT=work.data01 pred=pred reschi=reschi lower=lcl upper=ucl;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't want to repeat the same code for 10 times by just changing data01 to data02, data 03... data10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any clever way to use macro or other method to use a single piece of code to run over 10 datasets independently?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="plain"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Jul 2011 19:02:42 GMT</pubDate>
    <dc:creator>Howles</dc:creator>
    <dc:date>2011-07-11T19:02:42Z</dc:date>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28713#M6700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The random sampling created 10 datasets. For each dataset, I will need to run the same code as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC LOGISTIC DATA=work.data01;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLASS age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MODEL status=age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT OUT=work.data01 pred=pred reschi=reschi lower=lcl upper=ucl;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't want to repeat the same code for 10 times by just changing data01 to data02, data 03... data10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any clever way to use macro or other method to use a single piece of code to run over 10 datasets independently?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;:smileyplain:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 17:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28713#M6700</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-11T17:12:49Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28714#M6701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I am only doing 10-20 iterations, I find it easier to just do some simple macro code and duplicate the call line than to write (and debug!) macro loops.&amp;nbsp; Something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO logist(num);&lt;/P&gt;&lt;P&gt;PROC LOGISTIC DATA=work.data&amp;amp;num;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLASS age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MODEL status=age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT OUT=work.data&amp;amp;num pred=pred reschi=reschi lower=lcl upper=ucl;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;%MEND logist;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%logist(01);&lt;/P&gt;&lt;P&gt;%logist(02);&lt;/P&gt;&lt;P&gt;%logist(03);&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 18:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28714#M6701</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2011-07-11T18:43:15Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28715#M6702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Doc, thanks for sharing the idea. I don't know macro before. But this code does show the convenience and power of macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to learn! :smileylaugh:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 18:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28715#M6702</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-11T18:47:38Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28716#M6703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doc,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Besides, can I add some iteration DO statement for the macro so that it is more convenient than typing all %logist(01), %logist(02).... This saves time if there are say 500 data sets like data01, data02, ... data500 to run the same model.&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 18:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28716#M6703</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-11T18:58:40Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28717#M6704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even for your 10 I would use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro doloop;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %do i=1 %to 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROC LOGISTIC DATA=work.data%sysfunc(putn(&amp;amp;i.,z2.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MODEL status=age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OUTPUT OUT=work.dataout%sysfunc(putn(&amp;amp;i.,z2.))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pred=pred reschi=reschi lower=lcl upper=ucl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend doloop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%doloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, that does bring up something I changed in your code.&amp;nbsp; Do you REALLY want to have the output files to have the same names as the input files?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Art&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 19:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28717#M6704</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-11T19:01:28Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28718#M6705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Better to have the sampling produce one data set, with a variable to indicate the sample number. Then it's as simple as adding a BY statement to the PROC LOGISTIC step.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;bncoxuk wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The random sampling created 10 datasets. For each dataset, I will need to run the same code as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC LOGISTIC DATA=work.data01;&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLASS age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MODEL status=age sex married;&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUTPUT OUT=work.data01 pred=pred reschi=reschi lower=lcl upper=ucl;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just don't want to repeat the same code for 10 times by just changing data01 to data02, data 03... data10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any clever way to use macro or other method to use a single piece of code to run over 10 datasets independently?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="plain"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 19:02:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28718#M6705</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2011-07-11T19:02:42Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28719#M6706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art, so far so good. Can I ask what is putn and its format z2. here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 19:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28719#M6706</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-11T19:20:09Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28720#M6707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tested the code, worked perfectly. thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 19:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28720#M6707</guid>
      <dc:creator>bncoxuk</dc:creator>
      <dc:date>2011-07-11T19:46:38Z</dc:date>
    </item>
    <item>
      <title>How can I use a single program to run multiple data sets?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28721#M6708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The putn function simply enables you to specify a numeric format at run time.&amp;nbsp; Since you indicated that the file names had leading zeros, that is why I suggested the z format, as it displays numbers with leading zeros.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 20:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-use-a-single-program-to-run-multiple-data-sets/m-p/28721#M6708</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-11T20:35:03Z</dc:date>
    </item>
  </channel>
</rss>

