<?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: Reading in multiple datasets in a do-loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197707#M305457</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;copy and paste lost the %do loop. sorry. Yes SET OUTSIDE the do loop per Astounding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Aug 2015 19:45:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-08-12T19:45:28Z</dc:date>
    <item>
      <title>Reading in multiple datasets in a do-loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197703#M305453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;I am trying to read in several SAS datasets for US states, each with a filename that has the format &amp;lt;statename&amp;gt;births i.e. ARnew, AZnew, CAnew,&lt;/P&gt;&lt;P&gt;I have 45 such datasets that I want to combine. I am using a do-loop for this but get an error saying "work.set.data. does not exist". What am I doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname proj '... ';&lt;/P&gt;&lt;P&gt;%let statelist=%str(ak,ar,al,.....wi,wv);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro combine;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;%do k=1 %to 45;&lt;/P&gt;&lt;P&gt;%let state=%sysfunc(strip(%sysfunc(scan(&amp;amp;statelist,&amp;amp;k,','))));&lt;/P&gt;&lt;P&gt;set proj.&amp;amp;state.new&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%combine;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 18:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197703#M305453</guid>
      <dc:creator>dshills</dc:creator>
      <dc:date>2015-08-12T18:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in multiple datasets in a do-loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197704#M305454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One thing do check with unexpected macro results is to turn on the macro inspection options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you tried:&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;%combine;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would likely find in the log:&lt;/P&gt;&lt;P&gt;Set proj.aknew set proj.arnew&amp;nbsp; and so forth.&lt;/P&gt;&lt;P&gt;YOu did not put your SET in the correct place so SAS thinks you are looking for a data set name SET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use:&lt;/P&gt;&lt;P&gt;set&lt;/P&gt;&lt;P&gt;%let state=%sysfunc(strip(%sysfunc(scan(&amp;amp;statelist,&amp;amp;k,','))));&lt;/P&gt;&lt;P&gt;proj.&amp;amp;state.new&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;;&amp;nbsp; /* now this ; properly closes the SET statement*/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 18:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197704#M305454</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-12T18:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in multiple datasets in a do-loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197705#M305455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made the change but this didn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;libname proj '... ';&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let statelist=%str(ak,ar,al,.....wi,wv);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro combine;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data test;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%do k=1 %to 45;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt;set&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let state=%sysfunc(strip(%sysfunc(scan(&amp;amp;statelist,&amp;amp;k,','))));&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proj.&amp;amp;state.new&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%end;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%combine;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still get the message &lt;/P&gt;&lt;P&gt;"work.set.data does not exist."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 18:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197705#M305455</guid>
      <dc:creator>dshills</dc:creator>
      <dc:date>2015-08-12T18:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in multiple datasets in a do-loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197706#M305456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The word SET does not belong inside the %DO loop.&amp;nbsp; Move it to before the %DO statement, leaving everything else as is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 19:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197706#M305456</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-08-12T19:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in multiple datasets in a do-loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197707#M305457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;copy and paste lost the %do loop. sorry. Yes SET OUTSIDE the do loop per Astounding.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 19:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197707#M305457</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-12T19:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in multiple datasets in a do-loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197708#M305458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You to ballardw &amp;amp; astounding!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2015 20:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-multiple-datasets-in-a-do-loop/m-p/197708#M305458</guid>
      <dc:creator>dshills</dc:creator>
      <dc:date>2015-08-12T20:09:20Z</dc:date>
    </item>
  </channel>
</rss>

