<?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: Replacing IDs with the same value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758717#M239620</link>
    <description>&lt;P&gt;The data seems to be not sorted by id, but is grouped by id? If the data is grouped try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have(rename= (subjid = _subjid));
   by id notsorted;
   
   length subjid $ 6;
   retain subjid;
   
   if first.id then subjid = _subjid;
   
   drop _subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 Aug 2021 07:25:15 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-08-02T07:25:15Z</dc:date>
    <item>
      <title>Replacing IDs with the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758714#M239617</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;if I have a data that looks like this&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;input id 2. subjid $6. var1 $2. var2 $2. ;&lt;BR /&gt;datalines;&lt;BR /&gt;1  pat_1 A B&lt;BR /&gt;14 pat_2 C D&lt;BR /&gt;14 pat_3 E F&lt;BR /&gt;14 pat_4 G H&lt;BR /&gt;2  pat_5 I J&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;and want the subjid to be the same where id is the same, how do I do that?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 07:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758714#M239617</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-08-02T07:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing IDs with the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758716#M239619</link>
      <description>&lt;P&gt;So for ID = 14, what subjid should be applied ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first one encountered?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 07:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758716#M239619</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-08-02T07:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing IDs with the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758717#M239620</link>
      <description>&lt;P&gt;The data seems to be not sorted by id, but is grouped by id? If the data is grouped try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have(rename= (subjid = _subjid));
   by id notsorted;
   
   length subjid $ 6;
   retain subjid;
   
   if first.id then subjid = _subjid;
   
   drop _subjid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Aug 2021 07:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758717#M239620</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-02T07:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing IDs with the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758718#M239621</link>
      <description>yes, ID 14 should have a subjid pat_2</description>
      <pubDate>Mon, 02 Aug 2021 07:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758718#M239621</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-08-02T07:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing IDs with the same value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758763#M239655</link>
      <description>&lt;P&gt;Just for fun.&lt;/P&gt;
&lt;PRE&gt;data have;
input id 2. subjid $6. var1 $2. var2 $2. ;
datalines;
1  pat_1 A B
14 pat_2 C D
14 pat_3 E F
14 pat_4 G H
2  pat_5 I J
;
run;

proc sql;
create table want as
select id,min(subjid) as subjid,var1,var2
 from have
  group by id;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-IDs-with-the-same-value/m-p/758763#M239655</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-02T12:06:11Z</dc:date>
    </item>
  </channel>
</rss>

