<?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 how to merge data each month over the period from 2005 to 2015. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492955#M129650</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I want to merge data from 200501 to 201512 by following codes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;macro  base_of_cit4;
   %local y;
   %do y=2005 %to 2015;

   %local m;
   %do m=1 %to 12;

DATA Step4.number_of_cit_end ;
   MERGE Step3.Base3_of_cit&amp;amp;y.&amp;amp;m - Step3.Base3_of_cit&amp;amp;y.&amp;amp;m ;
   BY psn_name;
RUN;
     %end; 
     %end;

%mend base_of_cit4;   

%base_of_cit4;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the result is&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: File STEP3.BASE3_OF_CIT118382.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118383.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118384.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118385.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118386.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118387.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118388.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118389.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118390.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118391.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118392.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118393.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118394.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118395.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118396.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118397.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118398.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118399.DATA does not exist.
....

204  RUN;

205  %macro  base_of_cit4;
206     %local y;
207     %do y=2005 %to 2015;
208
209     %local m;
210     %do m=1 %to 12;
211
212  DATA Step5.number_of_cit_end ;
213     MERGE Step3.Base3_of_cit&amp;amp;y.&amp;amp;m - Step3.Base3_of_cit&amp;amp;y.&amp;amp;m ;
214     BY psn_name;
215  RUN;
216       %end;
217       %end;
218
219  %mend base_of_cit4;
220
221  %base_of_cit4;

NOTE: There were 4584 observations read from the data set STEP3.BASE3_OF_CIT20051.
NOTE: The data set STEP5.NUMBER_OF_CIT_END has 4584 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.86 seconds
      cpu time            0.03 seconds



NOTE: There were 4961 observations read from the data set STEP3.BASE3_OF_CIT20052.
NOTE: The data set STEP5.NUMBER_OF_CIT_END has 4961 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.28 seconds
      cpu time            0.04 seconds



NOTE: There were 5561 observations read from the data set STEP3.BASE3_OF_CIT20053.
NOTE: The data set STEP5.NUMBER_OF_CIT_END has 5561 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.21 seconds
      cpu time            0.04 seconds

....

NOTE: There were 0 observations read from the data set STEP3.BASE3_OF_CIT201511.
NOTE: The data set STEP4.NUMBER_OF_CIT2015 has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds



NOTE: There were 0 observations read from the data set STEP3.BASE3_OF_CIT201512.
NOTE: The data set STEP4.NUMBER_OF_CIT2015 has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Finally, I only get an empty table, could you please give me some suggestion about this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Sep 2018 10:39:33 GMT</pubDate>
    <dc:creator>France</dc:creator>
    <dc:date>2018-09-06T10:39:33Z</dc:date>
    <item>
      <title>how to merge data each month over the period from 2005 to 2015.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492955#M129650</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I want to merge data from 200501 to 201512 by following codes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;macro  base_of_cit4;
   %local y;
   %do y=2005 %to 2015;

   %local m;
   %do m=1 %to 12;

DATA Step4.number_of_cit_end ;
   MERGE Step3.Base3_of_cit&amp;amp;y.&amp;amp;m - Step3.Base3_of_cit&amp;amp;y.&amp;amp;m ;
   BY psn_name;
RUN;
     %end; 
     %end;

%mend base_of_cit4;   

%base_of_cit4;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the result is&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: File STEP3.BASE3_OF_CIT118382.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118383.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118384.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118385.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118386.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118387.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118388.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118389.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118390.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118391.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118392.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118393.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118394.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118395.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118396.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118397.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118398.DATA does not exist.
ERROR: File STEP3.BASE3_OF_CIT118399.DATA does not exist.
....

204  RUN;

205  %macro  base_of_cit4;
206     %local y;
207     %do y=2005 %to 2015;
208
209     %local m;
210     %do m=1 %to 12;
211
212  DATA Step5.number_of_cit_end ;
213     MERGE Step3.Base3_of_cit&amp;amp;y.&amp;amp;m - Step3.Base3_of_cit&amp;amp;y.&amp;amp;m ;
214     BY psn_name;
215  RUN;
216       %end;
217       %end;
218
219  %mend base_of_cit4;
220
221  %base_of_cit4;

NOTE: There were 4584 observations read from the data set STEP3.BASE3_OF_CIT20051.
NOTE: The data set STEP5.NUMBER_OF_CIT_END has 4584 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.86 seconds
      cpu time            0.03 seconds



NOTE: There were 4961 observations read from the data set STEP3.BASE3_OF_CIT20052.
NOTE: The data set STEP5.NUMBER_OF_CIT_END has 4961 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.28 seconds
      cpu time            0.04 seconds



NOTE: There were 5561 observations read from the data set STEP3.BASE3_OF_CIT20053.
NOTE: The data set STEP5.NUMBER_OF_CIT_END has 5561 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.21 seconds
      cpu time            0.04 seconds

....

NOTE: There were 0 observations read from the data set STEP3.BASE3_OF_CIT201511.
NOTE: The data set STEP4.NUMBER_OF_CIT2015 has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds



NOTE: There were 0 observations read from the data set STEP3.BASE3_OF_CIT201512.
NOTE: The data set STEP4.NUMBER_OF_CIT2015 has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Finally, I only get an empty table, could you please give me some suggestion about this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 10:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492955#M129650</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-09-06T10:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to merge data each month over the period from 2005 to 2015.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492958#M129653</link>
      <description>&lt;P&gt;Are you sure, that you need to merge the datasets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=basess&amp;amp;docsetTarget=p0y8rrzaeklkkin1tlyxeq5qskkp.htm&amp;amp;locale=de" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=basess&amp;amp;docsetTarget=p0y8rrzaeklkkin1tlyxeq5qskkp.htm&amp;amp;locale=de&lt;/A&gt; explains what merging does.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 10:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492958#M129653</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-09-06T10:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to merge data each month over the period from 2005 to 2015.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492967#M129657</link>
      <description>hello,&lt;BR /&gt;Yes, I am sure, cause I create the table for the number_of_cit each month for different companies during the period between 2005 and 2015. So I have 132 tables, and each table has only two variables, one is the company name, the other is the number_of_cit at the month ( e.g., 200501, 201512). That is why I need to merge them together.</description>
      <pubDate>Thu, 06 Sep 2018 11:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492967#M129657</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-09-06T11:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to merge data each month over the period from 2005 to 2015.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492977#M129662</link>
      <description>&lt;P&gt;If you simply want to merge ALL of the data sets with that name pattern, use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Step4.Number_of_cit_end;&lt;/P&gt;
&lt;P&gt;merge Step3.Base3_of_cit20: ;&lt;/P&gt;
&lt;P&gt;by ps_name;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No macros, no looping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should handle your original question.&amp;nbsp; However, I too question whether MERGE is the right thing to do.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 12:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-merge-data-each-month-over-the-period-from-2005-to-2015/m-p/492977#M129662</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-09-06T12:16:54Z</dc:date>
    </item>
  </channel>
</rss>

