<?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 perform a look-up type exercise in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711235#M219059</link>
    <description>&lt;P&gt;Hi, I am looking to perform a look-up type exercise but am unsure of how to carry it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simplified version of my dataset is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  Date1         Date2         Date3       Date&lt;BR /&gt;11/01/2020   11/05/2020     11/30/2020    Date1&lt;BR /&gt;12/01/2020   08/30/2020     06/14/2020    Date3&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;/PRE&gt;&lt;P&gt;What I want to do is create a new variable, say "ActualDate", that looks up the value of the variable "Date" and returns the value of the variable of that name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for the first row in the table above I would like ActualDate to equal "11/01/2020" and for the second row I would like it to equal "06/14/2020"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible and, if so, does anyone know what code is required? Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jan 2021 17:55:57 GMT</pubDate>
    <dc:creator>EC27556</dc:creator>
    <dc:date>2021-01-13T17:55:57Z</dc:date>
    <item>
      <title>How to perform a look-up type exercise in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711235#M219059</link>
      <description>&lt;P&gt;Hi, I am looking to perform a look-up type exercise but am unsure of how to carry it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simplified version of my dataset is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  Date1         Date2         Date3       Date&lt;BR /&gt;11/01/2020   11/05/2020     11/30/2020    Date1&lt;BR /&gt;12/01/2020   08/30/2020     06/14/2020    Date3&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;/PRE&gt;&lt;P&gt;What I want to do is create a new variable, say "ActualDate", that looks up the value of the variable "Date" and returns the value of the variable of that name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for the first row in the table above I would like ActualDate to equal "11/01/2020" and for the second row I would like it to equal "06/14/2020"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible and, if so, does anyone know what code is required? Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 17:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711235#M219059</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2021-01-13T17:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a look-up type exercise in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711250#M219070</link>
      <description>&lt;P&gt;Could your simplified dataset be structured like so?&amp;nbsp; :&lt;/P&gt;
&lt;PRE&gt;  Date1         Date2         Date3       Date
11/01/2020   11/05/2020     11/30/2020      1
12/01/2020   08/30/2020     06/14/2020      3
.
.
.&lt;/PRE&gt;
&lt;P&gt;Then this becomes a solution easily solved with an array, where date, as numeric, is the array index to the &lt;CODE class=" language-sas"&gt;date_&lt;/CODE&gt; array.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array date_[3] date1-date3;
ActualDate=date_[date];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 18:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711250#M219070</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-13T18:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a look-up type exercise in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711254#M219072</link>
      <description>&lt;P&gt;If you just want the formatted value of the variable (that is string) then use the VVALUEX() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  want_string = vvaluex(date);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2021 19:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711254#M219072</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-13T19:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a look-up type exercise in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711259#M219075</link>
      <description>&lt;P&gt;Great, thank you! I would be able to get just the numbers in the "Date" column so this should work. Would you be able to write your solution in a generalised form though as I am having some trouble interpreting it&amp;nbsp;(and therefore adjusting for my actual dataset!) I.e say Date1 was actually called X1, Date2 was X2 and Date3 was X3. Then say the "Date" variable was "Y" and "ActualDate" was "Z". How would your solution look in this case?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 19:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-perform-a-look-up-type-exercise-in-SAS/m-p/711259#M219075</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2021-01-13T19:34:47Z</dc:date>
    </item>
  </channel>
</rss>

