<?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: sas macro to run a long program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357950#M84084</link>
    <description>&lt;P&gt;What "numbers" do you need? It may well be that one of the report procedures will do what you need. For instance suppose I am looking at the SAS supplied SASHELP.CLASS data set and want to compare the height and weight variables mean and standard deviation statistics and see the overall statistics and for each level of the variable Sex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex;
   var height weight;
   table all sex,
         (Height weight)*(mean std);
run;&lt;/PRE&gt;
&lt;P&gt;will have 3 rows of output for the total and the two levels of sex with mean and standard deviations. Or changing the order in the TABLE statement could have the statistics as rows and the Sex and all as columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2017 15:25:08 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-05-11T15:25:08Z</dc:date>
    <item>
      <title>sas macro to run a long program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357940#M84078</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=lib.data1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=data2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;WHERE&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; mine=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;va1 va3&amp;nbsp;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I need your advice to how to improve my code so that it can be faster. I need to run this above code first and then, I need to run about 500 lines of code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;I need to compare the difference in these three situations, when mine=1, 0, or in the whole population.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;If I only need to compare the difference between mine=1 and mine=0, it is easy to have a sas macro to do that. But I need to compare these two to the over all population, which means, when I need numbers for the whole population, I need to remove this statement, where mine= ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;any suggestions to use macro here? Thank you&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 15:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357940#M84078</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-05-11T15:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro to run a long program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357942#M84079</link>
      <description>&lt;P&gt;There's no way that comparing "differences", whatever that means, takes 500 lines of code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So for us to help you, we'd need to see your code; or for you to explain what comparing "differences" means in a lot more detail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if the program is taking a long time, that could mean that you have a huge amount of data (not an unusual situation) and so it takes a long time to process. You haven't even told us how much total data you have ... and of course, you haven't been specific in what "faster" means ...&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 15:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357942#M84079</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-11T15:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro to run a long program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357950#M84084</link>
      <description>&lt;P&gt;What "numbers" do you need? It may well be that one of the report procedures will do what you need. For instance suppose I am looking at the SAS supplied SASHELP.CLASS data set and want to compare the height and weight variables mean and standard deviation statistics and see the overall statistics and for each level of the variable Sex:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex;
   var height weight;
   table all sex,
         (Height weight)*(mean std);
run;&lt;/PRE&gt;
&lt;P&gt;will have 3 rows of output for the total and the two levels of sex with mean and standard deviations. Or changing the order in the TABLE statement could have the statistics as rows and the Sex and all as columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 15:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357950#M84084</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-11T15:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro to run a long program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357953#M84086</link>
      <description>&lt;P&gt;Tip:&amp;nbsp;&lt;STRONG&gt;Post test data in the form of a datastep, and what you want the output to look like.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There really is not enough information in your post to formulate much of a guess, that being said, it may be that you can transpose your data up and then compare;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array mineresults{100} 8.;
  retain mineresults:;
  ...;
run; &lt;/PRE&gt;</description>
      <pubDate>Thu, 11 May 2017 15:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357953#M84086</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-11T15:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro to run a long program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357979#M84091</link>
      <description>&lt;P&gt;Macro language will not speed up anything here.&amp;nbsp; In fact, it will likely slow things down.&amp;nbsp; Macro language saves in programming time so when you have a working process for one data set, you can apply it easily to another data set.&amp;nbsp; But it doesn't speed up the processing of the original data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you haven't given us any of the 500 lines of code, let me give&amp;nbsp; you an example using just the PROC SORT code that you supplied.&amp;nbsp; If you had a macro to generate and sort each subgroup, you would never think along these lines ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider sorting the original data set permanently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=lib.data1&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;mine va1 va3&amp;nbsp;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At that point,&amp;nbsp; you can get statistics for each subgroup including a BY statement (by MINE; ) in the analysis.&amp;nbsp; Or, you could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=lib.data1&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;va1 va3&amp;nbsp;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;data mine0 mine1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;set lib.data1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;if mine=0 then output mine0;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;else output mine1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you have only sorted once.&amp;nbsp; But all three data sets are&amp;nbsp; in sorted order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These are the sorts of things you have to plan around to speed things up.&amp;nbsp; Macros won't help you think through the process.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 16:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-to-run-a-long-program/m-p/357979#M84091</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-11T16:17:28Z</dc:date>
    </item>
  </channel>
</rss>

