<?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: Merging Data: Adding one variable repeatedly to a longer series in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Adding-one-variable-repeatedly-to-a-longer-series/m-p/15678#M2087</link>
    <description>proc sql;&lt;BR /&gt;
   create work.desired as&lt;BR /&gt;
   select work.a.iteration,work.a.draw, work.b.*&lt;BR /&gt;
   from work.a left join work.b on work.a.id=work.b.id&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Might work for you. Sql joins often run quicker than MERGE on large data sets.</description>
    <pubDate>Fri, 17 Jun 2011 17:27:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2011-06-17T17:27:15Z</dc:date>
    <item>
      <title>Merging Data: Adding one variable repeatedly to a longer series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Adding-one-variable-repeatedly-to-a-longer-series/m-p/15677#M2086</link>
      <description>I have two datasets, lets call them A and B.&lt;BR /&gt;
&lt;BR /&gt;
A is the result of a Monte Carlo simulation and has 100,000 rows - 10,000 draws of a random variable (for this example) for each of 100 IDs/subjects/whatever.&lt;BR /&gt;
&lt;BR /&gt;
So it looks like:&lt;BR /&gt;
&lt;BR /&gt;
Iteration     ID   Draw&lt;BR /&gt;
1               1     0.073&lt;BR /&gt;
1               2     0.987&lt;BR /&gt;
1               3     0.487&lt;BR /&gt;
...&lt;BR /&gt;
2               1     0.278&lt;BR /&gt;
2               2     0.142&lt;BR /&gt;
&lt;BR /&gt;
etc.&lt;BR /&gt;
&lt;BR /&gt;
I also have a data set, with these same ID numbers, and a *fixed* set of variables. I'd like to merge them such that each of the 10,000 iterations of the ID sequence gets paired with the fixed variable data set.&lt;BR /&gt;
&lt;BR /&gt;
I think this is a fairly simple thing to do, but due to some other things running in the background, I can only manage to batch submit SAS jobs, so my usual code-tinkering techniques aren't available to me.&lt;BR /&gt;
&lt;BR /&gt;
Will a standard Merge and By work?&lt;BR /&gt;
&lt;BR /&gt;
For example:&lt;BR /&gt;
&lt;BR /&gt;
data work.desired;&lt;BR /&gt;
merge work.a work.b;&lt;BR /&gt;
by ID;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
?</description>
      <pubDate>Thu, 16 Jun 2011 23:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Adding-one-variable-repeatedly-to-a-longer-series/m-p/15677#M2086</guid>
      <dc:creator>epigrad</dc:creator>
      <dc:date>2011-06-16T23:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Data: Adding one variable repeatedly to a longer series</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Adding-one-variable-repeatedly-to-a-longer-series/m-p/15678#M2087</link>
      <description>proc sql;&lt;BR /&gt;
   create work.desired as&lt;BR /&gt;
   select work.a.iteration,work.a.draw, work.b.*&lt;BR /&gt;
   from work.a left join work.b on work.a.id=work.b.id&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Might work for you. Sql joins often run quicker than MERGE on large data sets.</description>
      <pubDate>Fri, 17 Jun 2011 17:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Data-Adding-one-variable-repeatedly-to-a-longer-series/m-p/15678#M2087</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-06-17T17:27:15Z</dc:date>
    </item>
  </channel>
</rss>

