<?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 Run a piece of code only if observations no is &amp;lt;30 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83541#M256817</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently working on a Macro to run two-sample T-Tests, and it is working well as expected. Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13589376713014702" jivemacro_uid="_13589376713014702" modifiedtitle="true"&gt;
&lt;P&gt;/* This is a macro for running two-sample T-Tests */&lt;/P&gt;
&lt;P&gt;%MACRO twot(dataSrc, depVar, factVar);&lt;/P&gt;
&lt;P&gt;TITLE "Hypothesis Test - H0: Mean &amp;amp;depVar by factor &amp;amp;factVar are equal";&lt;/P&gt;
&lt;P&gt;PROC TTEST DATA=&amp;amp;dataSrc;&lt;/P&gt;
&lt;P&gt;VAR &amp;amp;depVar;&lt;/P&gt;
&lt;P&gt;CLASS &amp;amp;factVar;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;/* blank line */&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;/* blank line */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;TITLE "Verifying the assumption of normality - &amp;amp;depVar by &amp;amp;factVar";&lt;/P&gt;
&lt;P&gt;PROC UNIVARIATE DATA=&amp;amp;dataSrc;&lt;/P&gt;
&lt;P&gt;VAR &amp;amp;depVar;&lt;/P&gt;
&lt;P&gt;CLASS &amp;amp;factVar;&lt;/P&gt;
&lt;P&gt;QQPLOT /NORMAL (MU=EST SIGMA=EST);&lt;/P&gt;
&lt;P&gt;HISTOGRAM /NORMAL;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;/* blank line */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;/* blank line */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;TITLE "Hypothesis Test - H0: Mean &amp;amp;depVar by factor &amp;amp;factVar are equal";&lt;/P&gt;
&lt;P&gt;PROC GCHART DATA=&amp;amp;dataSrc;&lt;/P&gt;
&lt;P&gt;HBAR &amp;amp;factVar / TYPE=MEAN SUMVAR=&amp;amp;depVar ERRORBAR=BARS CLM=95 NOFRAME;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;TITLE;&lt;/P&gt;
&lt;P&gt;%MEND twot;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically this Macro will take the datasource name and the dependent variable and the factor variable to be used to run the two-sample T-Test. If you look at the code from lines 10 to 16 however, this is a test to check the assumption of normality with a QQ PLOT and the bell curve plotted over a histogram.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is required if any of the groups in the T-Test have less than 30 observations. However, the way the code is now, this &lt;EM&gt;assumption of normality&lt;/EM&gt; code will run with any T-Test, regardless of how many obs there is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do is modify this macro so the &lt;EM&gt;assumption of normality&lt;/EM&gt; code (lines 10 to 16) would &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;only&lt;/STRONG&gt;&lt;/SPAN&gt; run if there is less than 30 observations in a given group. Is that possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2013 10:41:59 GMT</pubDate>
    <dc:creator>pmdci</dc:creator>
    <dc:date>2013-01-23T10:41:59Z</dc:date>
    <item>
      <title>Run a piece of code only if observations no is &lt;30</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83541#M256817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently working on a Macro to run two-sample T-Tests, and it is working well as expected. Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13589376713014702" jivemacro_uid="_13589376713014702" modifiedtitle="true"&gt;
&lt;P&gt;/* This is a macro for running two-sample T-Tests */&lt;/P&gt;
&lt;P&gt;%MACRO twot(dataSrc, depVar, factVar);&lt;/P&gt;
&lt;P&gt;TITLE "Hypothesis Test - H0: Mean &amp;amp;depVar by factor &amp;amp;factVar are equal";&lt;/P&gt;
&lt;P&gt;PROC TTEST DATA=&amp;amp;dataSrc;&lt;/P&gt;
&lt;P&gt;VAR &amp;amp;depVar;&lt;/P&gt;
&lt;P&gt;CLASS &amp;amp;factVar;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;/* blank line */&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;/* blank line */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;TITLE "Verifying the assumption of normality - &amp;amp;depVar by &amp;amp;factVar";&lt;/P&gt;
&lt;P&gt;PROC UNIVARIATE DATA=&amp;amp;dataSrc;&lt;/P&gt;
&lt;P&gt;VAR &amp;amp;depVar;&lt;/P&gt;
&lt;P&gt;CLASS &amp;amp;factVar;&lt;/P&gt;
&lt;P&gt;QQPLOT /NORMAL (MU=EST SIGMA=EST);&lt;/P&gt;
&lt;P&gt;HISTOGRAM /NORMAL;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;/* blank line */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: helvetica, arial; font-size: 12px;"&gt;/* blank line */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;TITLE "Hypothesis Test - H0: Mean &amp;amp;depVar by factor &amp;amp;factVar are equal";&lt;/P&gt;
&lt;P&gt;PROC GCHART DATA=&amp;amp;dataSrc;&lt;/P&gt;
&lt;P&gt;HBAR &amp;amp;factVar / TYPE=MEAN SUMVAR=&amp;amp;depVar ERRORBAR=BARS CLM=95 NOFRAME;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;TITLE;&lt;/P&gt;
&lt;P&gt;%MEND twot;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically this Macro will take the datasource name and the dependent variable and the factor variable to be used to run the two-sample T-Test. If you look at the code from lines 10 to 16 however, this is a test to check the assumption of normality with a QQ PLOT and the bell curve plotted over a histogram.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is required if any of the groups in the T-Test have less than 30 observations. However, the way the code is now, this &lt;EM&gt;assumption of normality&lt;/EM&gt; code will run with any T-Test, regardless of how many obs there is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do is modify this macro so the &lt;EM&gt;assumption of normality&lt;/EM&gt; code (lines 10 to 16) would &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;only&lt;/STRONG&gt;&lt;/SPAN&gt; run if there is less than 30 observations in a given group. Is that possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 10:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83541#M256817</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2013-01-23T10:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Run a piece of code only if observations no is &lt;30</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83542#M256818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first thing that came to mind was to add a sql step to put the class group cnts (you can combine the two and eliminate the creation of the dataset, but I left them separate steps just for clarity):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*Create dataset with the group cnts*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table grpcnt as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select &lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #ffffff;"&gt;&amp;amp;factVar&lt;/SPAN&gt;, count(*) as cnt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from &lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #ffffff;"&gt;&amp;amp;factVar&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by &lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; background-color: #ffffff;"&gt;&amp;amp;factVar&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*put minimum cnt in macro variable*/&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select min(cnt)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :mcnt&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from grpcnt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #ffffff; font-family: helvetica, arial;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then add macro code to control the lines you want to run conditionally:&lt;/P&gt;&lt;P&gt;%if &amp;amp;mcnt &amp;lt; 30 %then %do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**CODE LINES**&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont have a dataset to test this on, but I believe it will work. If not hopefully it points you down a good path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 13:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83542#M256818</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-01-23T13:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Run a piece of code only if observations no is &lt;30</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83543#M256819</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;Thanks for trying to hep but I am quite confused by the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I really need to create the temporary dataset (e.g.: &lt;EM&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;grpcnt&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/EM&gt;as per your example)? I was hoping that I could save the count value in a macro variable that I could then refer to in my macro in an IF-THEN statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm also a bit confused with the proposed code &lt;STRONG style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;%if &amp;amp;mcnt &amp;lt; 30 %then %do&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was under the impression that macros start with &lt;STRONG&gt;%MACRO [name]&lt;/STRONG&gt; and end with &lt;STRONG&gt;%MEND [name]&lt;/STRONG&gt;. Also, not sure how to interpret the %then and %do syntax. Is that part of the same macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 13:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83543#M256819</guid>
      <dc:creator>pmdci</dc:creator>
      <dc:date>2013-01-23T13:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run a piece of code only if observations no is &lt;30</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83544#M256820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Here is a similar option:&lt;/P&gt;&lt;P&gt;In your PROC TTEST I would add an ODS OUTPUT statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc ttest data = ;&lt;/P&gt;&lt;P&gt;class;&lt;/P&gt;&lt;P&gt;var;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ODS OUTPUT Statistics = number(keep = n);*THIS GIVES YOU THE NUMBER OF RECs PER CLASS;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql noprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select min(n) into :cnt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from number;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;if &amp;amp;cnt. &amp;gt; 30 %then %do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*------THE REST OF YOUR CODE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 13:33:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83544#M256820</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2013-01-23T13:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Run a piece of code only if observations no is &lt;30</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83545#M256821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I didnt have a convenient test dataset I kept the code broken up to keep simple. I believe the following would eliminate the temp dataset I proposed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="color: #000000; font-family: helvetica, arial; font-size: 12px; font-style: inherit; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select min(cnt)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :mcnt&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from (&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select &lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&amp;amp;factVar&lt;/SPAN&gt;, count(*) as cnt&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from &lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&amp;amp;factVar&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by &lt;SPAN style="font-style: inherit;"&gt;&amp;amp;factVar&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-style: inherit; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-style: inherit; font-family: helvetica, arial;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;The code you proved was already in a macro. The code I suggested is just part of that macro that you supplied.&amp;nbsp; Put %if line above line 10 (ie the start of the code that you want to run conditionally) then you need a %end at the end of the code that you want to run conditionally (after line 16 in code above).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;The macro conditional code is similar to a conditional logic in a standard data step. All the lines after the do (up until the end) are run if the condition is met.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;Hope this helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 12px; font-family: helvetica, arial; color: #000000;"&gt;EJ&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 13:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83545#M256821</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-01-23T13:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Run a piece of code only if observations no is &lt;30</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83546#M256822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another good option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 13:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Run-a-piece-of-code-only-if-observations-no-is-lt-30/m-p/83546#M256822</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-01-23T13:42:26Z</dc:date>
    </item>
  </channel>
</rss>

