<?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: Need help with merging data into an array in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143839#M38258</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that will work the way you expect, the merge will overwrite the variable before you place it in the array. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may be an example of a better place for a sql join. It does seem like no matter what, there's a bit of manual coding unfortunately. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Dec 2014 00:51:07 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-12-10T00:51:07Z</dc:date>
    <item>
      <title>Need help with merging data into an array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143838#M38257</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 merge some datasets into one, (5 to 1) to be exact.&amp;nbsp; Four of the datasets have 3 variables idnum, attemptresult and numbertimes.&lt;/P&gt;&lt;P&gt;The other dataset is the master which has all of these varaibles and several others.&amp;nbsp; They all have&amp;nbsp; idnum in common to merge by.&amp;nbsp; What I would like to do is create&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;merge one two three four five;&lt;/P&gt;&lt;P&gt;by cardid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I have two variables in common attemptresult and numbertimes I wanted to build an array to house those guys&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array attresult_array {5} $15. attresult1-attresult5;&lt;/P&gt;&lt;P&gt;array numtime_array {5} 8. numtime1-numtime5;&lt;/P&gt;&lt;P&gt;do i = 1 to 5;&lt;/P&gt;&lt;P&gt;attresult_array{i}=attemptresult;&lt;/P&gt;&lt;P&gt;numtime_array{i}=numtimecalled;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure how to put this all together.&amp;nbsp; I tried placing the array creation right after the data combine line, and then the do to end after the by idnum line.&amp;nbsp; It didn't work, the array was empty. Can someone tell me how to accomplish this task?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;array attresult_array {5} $15. attresult1-attresult5;&lt;/P&gt;&lt;P&gt;array numtime_array {5} 8. numtime1-numtime5;&lt;/P&gt;&lt;P&gt;merge one two three four five;&lt;/P&gt;&lt;P&gt;by cardid;&lt;/P&gt;&lt;P&gt;do i = 1 to 5;&lt;/P&gt;&lt;P&gt;attresult_array{i}=attemptresult;&lt;/P&gt;&lt;P&gt;numtime_array{i}=numtimecalled;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 00:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143838#M38257</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2014-12-10T00:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with merging data into an array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143839#M38258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that will work the way you expect, the merge will overwrite the variable before you place it in the array. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may be an example of a better place for a sql join. It does seem like no matter what, there's a bit of manual coding unfortunately. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 00:51:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143839#M38258</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-12-10T00:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with merging data into an array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143840#M38259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this might do the trick - I'm assuming there is only 1 record per cardid in each input dataset:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combine;&lt;/P&gt;&lt;P&gt;array attresult_array {5} $15. attresult1-attresult5;&lt;/P&gt;&lt;P&gt;array numtime_array {5} 8. numtime1-numtime5;&lt;/P&gt;&lt;P&gt;retain attresult1-attresult5 numtime1-numtime5; &lt;/P&gt;&lt;P&gt;set one two three four five;&lt;/P&gt;&lt;P&gt;by cardid;&lt;/P&gt;&lt;P&gt;if first.cardid then i = 0;&lt;/P&gt;&lt;P&gt;i + 1;&lt;/P&gt;&lt;P&gt;attresult_array{i}=attemptresult;&lt;/P&gt;&lt;P&gt;numtime_array{i}=numtimecalled;&lt;/P&gt;&lt;P&gt;if last.cardid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 01:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143840#M38259</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2014-12-10T01:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with merging data into an array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143841#M38260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds more like a job for the RENAME dataset option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;merge&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; one (rename=(&lt;SPAN style="background-color: #ffffff;"&gt;attemptresult=attresult1 numbertimes=numtime1)&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; two (rename=(&lt;SPAN style="background-color: #ffffff;"&gt;attemptresult=attresult2 numbertimes=numtime2)&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; three (rename=(&lt;SPAN style="background-color: #ffffff;"&gt;attemptresult=attresult3 numbertimes=numtime3)&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; four (rename=(&lt;SPAN style="background-color: #ffffff;"&gt;attemptresult=attresult4 numbertimes=numtime4)&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; five (rename=(&lt;SPAN style="background-color: #ffffff;"&gt;attemptresult=attresult5 numbertimes=numtime5)&lt;/SPAN&gt;)&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;by cardid;&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 01:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143841#M38260</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-12-10T01:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with merging data into an array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143842#M38261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That did the trick.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 01:16:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-with-merging-data-into-an-array/m-p/143842#M38261</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2014-12-10T01:16:07Z</dc:date>
    </item>
  </channel>
</rss>

