<?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: Creating and using Macro variables in a loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86225#M18501</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you're aiming to get them all in the same dataset at the end using that data final loop at the end a proc append seems better to me within rather than storing 1000's of macro variables..&lt;/P&gt;&lt;P&gt;My opinion though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro (param1, param2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Set aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Proc reg data =bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;…….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;output out parameterestimates=reg1;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;proc reg data=bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;output out parameterestimates=reg2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;data reg1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;set reg1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;model=some_model_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;data reg2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;set reg2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;model=some_model_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;proc append data=reg1 base=linreg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;proc append data=reg2; base=multreg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;data final;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;merge linreg multreg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;by some_model_id;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Nov 2012 16:56:56 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2012-11-30T16:56:56Z</dc:date>
    <item>
      <title>Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86220#M18496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Program to created two macro variables mm and nn.&lt;/P&gt;&lt;P&gt;/*****************Top***********/&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Set aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Proc reg data =bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;…….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Call symputx(‘mm’, ...);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;.......&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Call symputx(‘nn’,...);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;/********************Bottom*****************/&lt;/P&gt;&lt;P&gt;Each time above program(Top to bottom) is run, we get a value&amp;nbsp; for&amp;nbsp; each mm and nn. For different runs these values will be different. I need to run the above program(Top-bottom) 100 times to extract 100 different values for&amp;nbsp; mm and nn. I tried something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: courier new,courier;"&gt;%Macro Test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-family: courier new,courier;"&gt;% global mm1 nn1;&lt;/SPAN&gt;&amp;nbsp; /*I am trying make these variables global to use in the next program.*/&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399;"&gt;….above program from top to bottom&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;%let mm1= &amp;amp;mm;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;%let nn1= &amp;amp;nn; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;%Mend Test;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .................................. This still does not work!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally,&amp;nbsp; would like to extract 100 values of these variables the following way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;Data final;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;Do i=1 to 100;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;%Test&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;Mm2 =&amp;amp;mm1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;Nn2=&amp;amp;nn1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;Output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;drop i;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;End;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; color: #008000;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was what I tried.....need some help .....&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;Raghu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 00:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86220#M18496</guid>
      <dc:creator>rnmishra</dc:creator>
      <dc:date>2012-11-30T00:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86221#M18497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are you trying to do? There easier ways to capture the the parameter estimates from multiple regression models in a single file. &lt;/P&gt;&lt;P&gt;See the last example here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/seminars/sas_macros_introduction/default.htm" title="http://www.ats.ucla.edu/stat/sas/seminars/sas_macros_introduction/default.htm"&gt;Statistical Computing Seminar: Introduction to SAS Macro Language&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 01:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86221#M18497</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-11-30T01:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86222#M18498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand what you mean to say. But in this case those mm and nn variables/parameter estimates are from two different regression procedures. mm&amp;nbsp; is the parameter estimate(b1) from simple linear regression and nn from weighted regression. There is a random number option in one of the programs, so each time we run above program&lt;/P&gt;&lt;P&gt;Top-bottom we get one mm from one model and one nn from another. I need to run this many times ....actually 1000 times and keep extracting these estimates. It looks like bootstrapping but it is not. I did something like this in R but this time I need to use SAS. Thanks for your response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 01:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86222#M18498</guid>
      <dc:creator>rnmishra</dc:creator>
      <dc:date>2012-11-30T01:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86223#M18499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is coding pattern that might work for you.&amp;nbsp; You will not need to change you existing program as it can continue to generate MM and NN macro variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro loop ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc delete data=final; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%do i=1 to 100 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;your existing program&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* Generate single obs dataset ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data this_case ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; mm=&amp;amp;mm; nn=&amp;amp;nn ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* Generate aggregate dataset ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc append base=final data=this_case;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend loop;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 02:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86223#M18499</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-11-30T02:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86224#M18500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom!&lt;/P&gt;&lt;P&gt;With your help I was able to complete what I aiming to do. I am still a kindergartener at Macro school.&lt;/P&gt;&lt;P&gt;I do not have the skills to access the data set final..created within the macro.&amp;nbsp; Instead ran the program 100 times manually and got what I&amp;nbsp; was looking for...very inefficient. Is there a way I can extract this data set 'final' after running the macro.&lt;/P&gt;&lt;P&gt;Sorry for my silly stuff.&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Raghu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 15:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86224#M18500</guid>
      <dc:creator>rnmishra</dc:creator>
      <dc:date>2012-11-30T15:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86225#M18501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you're aiming to get them all in the same dataset at the end using that data final loop at the end a proc append seems better to me within rather than storing 1000's of macro variables..&lt;/P&gt;&lt;P&gt;My opinion though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro (param1, param2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Data bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Set aa;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;……&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Proc reg data =bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;…….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;output out parameterestimates=reg1;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;Run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;proc reg data=bb;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;output out parameterestimates=reg2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;data reg1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;set reg1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;model=some_model_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;data reg2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;set reg2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;model=some_model_id;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;proc append data=reg1 base=linreg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;proc append data=reg2; base=multreg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;data final;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;merge linreg multreg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;by some_model_id;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333399; font-family: courier new,courier;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 16:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86225#M18501</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-11-30T16:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating and using Macro variables in a loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86226#M18502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends on how you are running SAS.&amp;nbsp; It you are running interactively then the FINAL dataset should be in the WORK library and you can print it or run statistical procs against it.&lt;/P&gt;&lt;P&gt; proc print data=final; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are running as a batch (or background) job then you should create a LIBNAME statement and write the data to that libname instead of the work.&lt;/P&gt;&lt;P&gt; LIBNAME mydata 'c:\mydate';&amp;nbsp; data mydata.final; set final; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using EG then I am not sure, but it should have method to store or download the dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 17:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-and-using-Macro-variables-in-a-loop/m-p/86226#M18502</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-11-30T17:49:20Z</dc:date>
    </item>
  </channel>
</rss>

