<?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: Creating an Indicator using an existing Unique Identifier in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750326#M235997</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/387246"&gt;@vbylsma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good afternoon,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am cleaning longitudinal data in a wide format. Each individual in the dataset has 1-5 records and I am implementing some logic steps to determine which 2 records to keep for each person. I could create a dummy variable and label each row 1_2 or 2_4 to indicate which records to keep, then later run a PROC SQL to pull the records, but I am wondering if it's possible to use the unique identifier for each record *as* the dummy variable. Examples below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Here is what I have that works:&lt;/U&gt;&lt;BR /&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 60 then "1_2"&lt;BR /&gt;When Vaccine2 is missing then "1"&lt;BR /&gt;Else "F"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;BUT is it possible to do something like this?:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 20 then "ImmRecID1_ImmRecID2"&lt;BR /&gt;When Vaccine2 is missing then "ImmRecID1"&lt;BR /&gt;Else "F"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As written it doesn't work, but any tips to tell SAS "Use the value from 'ImmRecID1' and 'ImmRecID2' here" would be awesome! The customer would prefer it's returned to a long format when we are finished, so I will need a list of all the unique record identifiers in the end. Any other suggestions are also welcome!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you provide text in quotes that is the value such as then "ImmRecID1_ImmRecID2"&lt;/P&gt;
&lt;P&gt;If you mean to combine the values of variables then you need to use a function that does such.&lt;/P&gt;
&lt;P&gt;Possibly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 20 then then catx('_',ImmRecID1,ImmRecID2)&lt;BR /&gt;When Vaccine2 is missing then cats(ImmRecID1)&lt;BR /&gt;Else "F"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If those variables you reference are numeric then you are subject to SAS implied numeric to character conversion rules.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jun 2021 20:46:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-06-24T20:46:03Z</dc:date>
    <item>
      <title>Creating an Indicator using an existing Unique Identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750313#M235984</link>
      <description>&lt;P&gt;Good afternoon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am cleaning longitudinal data in a wide format. Each individual in the dataset has 1-5 records and I am implementing some logic steps to determine which 2 records to keep for each person. I could create a dummy variable and label each row 1_2 or 2_4 to indicate which records to keep, then later run a PROC SQL to pull the records, but I am wondering if it's possible to use the unique identifier for each record *as* the dummy variable. Examples below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Here is what I have that works:&lt;/U&gt;&lt;BR /&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 60 then "1_2"&lt;BR /&gt;When Vaccine2 is missing then "1"&lt;BR /&gt;Else "F"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;BUT is it possible to do something like this?:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 20 then "ImmRecID1_ImmRecID2"&lt;BR /&gt;When Vaccine2 is missing then "ImmRecID1"&lt;BR /&gt;Else "F"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As written it doesn't work, but any tips to tell SAS "Use the value from 'ImmRecID1' and 'ImmRecID2' here" would be awesome! The customer would prefer it's returned to a long format when we are finished, so I will need a list of all the unique record identifiers in the end. Any other suggestions are also welcome!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750313#M235984</guid>
      <dc:creator>vbylsma</dc:creator>
      <dc:date>2021-06-24T20:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Indicator using an existing Unique Identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750315#M235986</link>
      <description>Post some example data and expected output and we can help with the code. &lt;BR /&gt;Include data that's representative of your actual data.</description>
      <pubDate>Thu, 24 Jun 2021 20:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750315#M235986</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-24T20:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Indicator using an existing Unique Identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750321#M235992</link>
      <description>&lt;LI-CODE lang="sas"&gt;data have;
      input PtID:10. Vaccine1:$10. ImmRecID1:8. Vaccine2:$10. ImmRecID2:8. days_between:3;
 datalines;
1234567890 Polio 11223344 Shingles 99887766 67
9876543201 Influenza 44556677 MMR 88556699 32
8765432189 Tetanus 66554499 . . 
; 
run;&lt;/LI-CODE&gt;&lt;P&gt;Of course, the data itself goes from Vaccine1 to Vaccine 5, but for the first part of the logic I'm only looking at vaccines 1 and 2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I'm working in EG, so I hope this sample of data will work. If not, let me know and I will try to provide whatever else is needed.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750321#M235992</guid>
      <dc:creator>vbylsma</dc:creator>
      <dc:date>2021-06-24T20:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Indicator using an existing Unique Identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750324#M235995</link>
      <description>Expected output given this?</description>
      <pubDate>Thu, 24 Jun 2021 20:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750324#M235995</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-24T20:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Indicator using an existing Unique Identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750326#M235997</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/387246"&gt;@vbylsma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good afternoon,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am cleaning longitudinal data in a wide format. Each individual in the dataset has 1-5 records and I am implementing some logic steps to determine which 2 records to keep for each person. I could create a dummy variable and label each row 1_2 or 2_4 to indicate which records to keep, then later run a PROC SQL to pull the records, but I am wondering if it's possible to use the unique identifier for each record *as* the dummy variable. Examples below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Here is what I have that works:&lt;/U&gt;&lt;BR /&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 60 then "1_2"&lt;BR /&gt;When Vaccine2 is missing then "1"&lt;BR /&gt;Else "F"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;BUT is it possible to do something like this?:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 20 then "ImmRecID1_ImmRecID2"&lt;BR /&gt;When Vaccine2 is missing then "ImmRecID1"&lt;BR /&gt;Else "F"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As written it doesn't work, but any tips to tell SAS "Use the value from 'ImmRecID1' and 'ImmRecID2' here" would be awesome! The customer would prefer it's returned to a long format when we are finished, so I will need a list of all the unique record identifiers in the end. Any other suggestions are also welcome!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you provide text in quotes that is the value such as then "ImmRecID1_ImmRecID2"&lt;/P&gt;
&lt;P&gt;If you mean to combine the values of variables then you need to use a function that does such.&lt;/P&gt;
&lt;P&gt;Possibly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When Vaccine1 = Vaccine2 and days_between2 &amp;gt;= 20 then then catx('_',ImmRecID1,ImmRecID2)&lt;BR /&gt;When Vaccine2 is missing then cats(ImmRecID1)&lt;BR /&gt;Else "F"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If those variables you reference are numeric then you are subject to SAS implied numeric to character conversion rules.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750326#M235997</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-24T20:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an Indicator using an existing Unique Identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750328#M235999</link>
      <description>&lt;P&gt;Worked perfectly, thank you! I knew it was able to be done, I just haven't needed to do it before.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 20:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-an-Indicator-using-an-existing-Unique-Identifier/m-p/750328#M235999</guid>
      <dc:creator>vbylsma</dc:creator>
      <dc:date>2021-06-24T20:44:10Z</dc:date>
    </item>
  </channel>
</rss>

