title: Attach values to one table from a differently shaped table
body: <p>So I have a data set collected from beekeeper surveys that looks something like this:</p>
  
  <pre><code>[Table 1]
   ID | Crop | Year | Hives | HoneyP | CropP |
  ----+------+------+-------+--------+-------+
    1      2   2014    2391        .       .
    2      4   2008     136        .       .
    3     12   2019   12346        .       .
  
           |                    |
           V   (and so on...)   V
  </code></pre>
  
  <p>I also have a spreadsheet of crop prices over a time series, e.g.</p>
  
  <pre><code>[Table 2]
  Year | Crop1 | Crop2 |
  -----+-------+-------+
  2008   $2.56   $6.45                    
  2009   $2.42   $6.64                    -&gt;
  2010   $2.69   $6.68   (and more crops) -&gt;
  2011   $2.62   $7.05                    -&gt;
  ...
  </code></pre>
  
  <p>Is it possible in PSPP/SPSS to iterate over the observations in Table 1 and insert values from Table 2 into the <code>CropP</code> variable based on the year and crop identifier?
  This is what I'm imagining, in pseudo-code:</p>
  
  <pre><code>for each obs:
      obs.CropP = Table2[obs.Year][obs.Crop]
  </code></pre>
  
  <p>I also have other attributes I want to add in to the observations (e.g. price index), but they're all one dimensional and could be entered manually if necessary; if I can programmatically add in a crop's price in the survey year, it would save a lot of time and trouble.</p>