<?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: with macro and do loop to create multiple proc freq tables, why my sas code does not work in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279525#M56340</link>
    <description>&lt;P&gt;Try it and see. The beauty of coding is that you can try things and see if they work and if they don't you can change it.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2016 18:49:42 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-22T18:49:42Z</dc:date>
    <item>
      <title>with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279409#M56326</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gray;
set gd;
daygra= re_bgn-joindate;
if daygra le 365 and daygra NE . then gra1y= 'Y';
else gra1y ='N';
 if daygra le 730 and daydep gt 365 then gra2y = 'Y';
else gra2y ='N';
 if daygra le 1096 and daygra gt 730 then gra3y = 'Y';
else dep3='N';
 if daydep le 1461 and daygra gt 1096  then gra4y = 'Y';
else gra3y ='N';
	run;
%macro demog (dem);

PROC freq DATA=gray;
TITLE "score  and &amp;amp;dem";
tables graiy*score &amp;amp;dem*score / norow nocol expected chisq;

RUN;
	%do i=1 %to 4;
%end;
%mend;

%demog(age);
%demog(sex);
%demog(edu);
run;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to see how many years people can graduate, whether it is related to their demographic features. any advice to fix it? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error message shows the variable, gra1y does not exist, that is not true, i did check the dataset. i also changed the variable name to gra1, gra2 but still it does not work. the error message showed gra1 does not exist&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279409#M56326</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-06-22T16:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279412#M56327</link>
      <description>&lt;P&gt;Reread the error and your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You our have the letter i, not 1 in your code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279412#M56327</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-22T16:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279417#M56331</link>
      <description>&lt;P&gt;There are a few issues to fix.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First is the position of the %DO statement.&amp;nbsp; It should come before PROC FREQ.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second is the use of grayiy.&amp;nbsp; It should be gray&amp;amp;i.y instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, take a look at the prior DATA step.&amp;nbsp; I'm not sure that the ELSE statements are doing the right thing.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 16:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279417#M56331</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-22T16:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279432#M56332</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 17:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279432#M56332</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-06-22T17:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279457#M56336</link>
      <description>&lt;P&gt;If you use a different naming convention for your new variables you can avoid a macro. For example if you use gray+number instead you can use the colon to list all at once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC freq DATA=gray;
TITLE "score  and &amp;amp;dem";
tables (gray:)*score &amp;amp;dem*score / norow nocol expected chisq;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jun 2016 18:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279457#M56336</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-22T18:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279492#M56338</link>
      <description>&lt;P&gt;mine is gray1y, gray2y&lt;/P&gt;&lt;P&gt;should I first change them to gray1, gray2, then I can use your code to avoid the do loop? Is that what you mean?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 18:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279492#M56338</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-06-22T18:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: with macro and do loop to create multiple proc freq tables, why my sas code does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279525#M56340</link>
      <description>&lt;P&gt;Try it and see. The beauty of coding is that you can try things and see if they work and if they don't you can change it.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 18:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/with-macro-and-do-loop-to-create-multiple-proc-freq-tables-why/m-p/279525#M56340</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-22T18:49:42Z</dc:date>
    </item>
  </channel>
</rss>

