<?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: use macro to repeat data step with merge? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110604#M22945</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Victoria,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have updated my code:&lt;/P&gt;&lt;P&gt;%macro test(likevar);&lt;/P&gt;&lt;P&gt;%do i=11 %to 50;&lt;/P&gt;&lt;P&gt;data merge_tblb&amp;amp;i.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge tbl1 (in=a) tblb&amp;amp;i. (in=b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not b;&lt;/P&gt;&lt;P&gt;proc print data=&amp;amp;syslast;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where id like "&amp;amp;likevar.%";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id date staff;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jul 2012 18:02:17 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2012-07-18T18:02:17Z</dc:date>
    <item>
      <title>use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110601#M22942</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 need to create multiple datasets, each one the product of a merge of two tables. Then I need to print the output of this merge. I have to do this around 60 times so I am hoping I can use a macro to do this, but I am new to them and have not worked with them before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code that I will need to run over and over again and the bolded objects will change each time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &lt;STRONG&gt;merge_one&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge tbl1 (in=a) &lt;STRONG&gt;tbl2 &lt;/STRONG&gt;(in=b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not b;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=&lt;STRONG&gt;merge_one;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where id like '&lt;STRONG&gt;01%&lt;/STRONG&gt;';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id date staff;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any help would be much appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 16:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110601#M22942</guid>
      <dc:creator>victoriav</dc:creator>
      <dc:date>2012-07-18T16:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110602#M22943</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;You can try creating a macro function based on the existing code, e.g. (untested):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro mymerge(dsname,tname,likevar);&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-family: 'courier new', courier;"&gt;&amp;nbsp; data &lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&amp;amp;dsname&lt;/STRONG&gt;&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="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge tbl1 (in=a) &lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&amp;amp;tname &lt;/STRONG&gt;&lt;/SPAN&gt;(in=b);&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-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&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-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not b;&lt;/SPAN&gt;&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;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; proc print data=&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&amp;amp;dsname;&lt;/STRONG&gt;&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="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where id like &lt;STRONG style="font-family: 'courier new', courier; background-color: #ffffff;"&gt;"&lt;/STRONG&gt;&lt;STRONG&gt;&amp;amp;likevar&lt;/STRONG&gt;&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;%"&lt;/STRONG&gt;&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="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id date staff;&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-family: 'courier new', courier;"&gt;&amp;nbsp; run;&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-family: 'courier new', courier;"&gt;%mend mymerge;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Please note the use of double quotes (") instead of the single quotes (') used with the &lt;SPAN style="font-family: 'courier new', courier;"&gt;like&lt;/SPAN&gt; operator, as macro variables do not resolve when surrounded by single quotes.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Then you can invoke the macro function, e.g.:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&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-family: 'courier new', courier;"&gt;%mymerge(aaa,bbb,ccc);&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-family: 'courier new', courier;"&gt;%mymerge(ddd,eee,fff);&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-family: 'courier new', courier;"&gt;%mymerge(ggg,hhh,iii);&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-family: 'courier new', courier;"&gt;etc...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If there is some pattern to the data set names and values to be supplied, then there is a chance that all 60 invocations could be automated in a loop.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Regards,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 17:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110602#M22943</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2012-07-18T17:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110603#M22944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data set names do have a pattern. The pattern is TBLB11.....TBLB50.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I was going to do something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new',courier;"&gt;%macro mymerge(tname,likevar);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp; %do I=11 %to 50;&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-family: 'courier new',courier;"&gt;&amp;nbsp; data tblb&amp;amp;I;&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-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge tbl1 (in=a) &lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&amp;amp;tname &lt;/STRONG&gt;&lt;/SPAN&gt;(in=b);&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-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&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-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not b;&lt;/SPAN&gt;&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;&lt;SPAN style="font-family: 'courier new',courier;"&gt;&amp;nbsp; proc print data= tblb&amp;amp;I&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&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="font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where id like &lt;STRONG style="font-family: 'courier new',courier; background-color: #ffffff;"&gt;"&amp;amp;likevar&lt;/STRONG&gt;&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;%"&lt;/STRONG&gt;&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="font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id date staff;&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-family: 'courier new',courier;"&gt;&amp;nbsp; run;&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-family: 'courier new',courier;"&gt;%END&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-family: 'courier new',courier;"&gt;%mend mymerge;&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-family: 'courier new',courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you for the note on the double quotes-I think that was one of my problems. This was so fun! I will try this way and Linlin's way (I am less familiar with her code but I would love to learn!) as well and report back soon. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Victoria&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 17:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110603#M22944</guid>
      <dc:creator>victoriav</dc:creator>
      <dc:date>2012-07-18T17:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110604#M22945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Victoria,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have updated my code:&lt;/P&gt;&lt;P&gt;%macro test(likevar);&lt;/P&gt;&lt;P&gt;%do i=11 %to 50;&lt;/P&gt;&lt;P&gt;data merge_tblb&amp;amp;i.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge tbl1 (in=a) tblb&amp;amp;i. (in=b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not b;&lt;/P&gt;&lt;P&gt;proc print data=&amp;amp;syslast;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where id like "&amp;amp;likevar.%";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id date staff;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 18:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110604#M22945</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-18T18:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110605#M22946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LinLin,&lt;/P&gt;&lt;P&gt;Your first post has addressed an practical approach, as long as the library info is available, you don't need to look for naming pattern (what if there is none?). The only part was missing in your post is how to get tables names, so why not just use some metadata?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select distinct memname into :dsn separated by ' ' from dictionary.columns where libname='WORK';&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 18:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110605#M22946</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-07-18T18:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110606#M22947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haikuo,&lt;/P&gt;&lt;P&gt;My first post doesn’t work because there is no macro variable for &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN lang="EN" style="color: #575757; font-family: 'Courier New'; font-size: 10pt; mso-ansi-language: EN;"&gt;where id like &lt;STRONG&gt;&lt;SPAN style="background: white; font-family: 'Courier New';"&gt;"&amp;amp;likevar&lt;SPAN style="font-style: inherit;"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;%"&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks - Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 18:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110606#M22947</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-18T18:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110607#M22948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your need a ";" after "END".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new',courier;"&gt;%macro mymerge(tname,likevar);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp; %do I=11 %to 50;&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-family: 'courier new',courier;"&gt;&amp;nbsp; data tblb&amp;amp;I;&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-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge tbl1 (in=a) &lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;&amp;amp;tname &lt;/STRONG&gt;&lt;/SPAN&gt;(in=b);&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-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&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-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not b;&lt;/SPAN&gt;&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;&lt;SPAN style="font-family: 'courier new',courier;"&gt;&amp;nbsp; proc print data= tblb&amp;amp;I&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&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="font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where id like &lt;SPAN style="font-family: 'courier new',courier; background-color: #ffffff;"&gt;&lt;STRONG&gt;"&amp;amp;likevar&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit;"&gt;&lt;STRONG&gt;%"&lt;/STRONG&gt;&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="font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id date staff;&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-family: 'courier new',courier;"&gt;&amp;nbsp; run;&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: #ff0000; font-family: 'courier new',courier;"&gt;%END&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-family: 'courier new',courier;"&gt;%mend mymerge;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 18:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110607#M22948</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-18T18:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: use macro to repeat data step with merge?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110608#M22949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Linlin, your code worked! I appreciate your help. Also thanks to Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 19:12:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-to-repeat-data-step-with-merge/m-p/110608#M22949</guid>
      <dc:creator>victoriav</dc:creator>
      <dc:date>2012-07-18T19:12:16Z</dc:date>
    </item>
  </channel>
</rss>

