<?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: ERROR: The ID value occurs twice in the same BY group in Proc Transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914633#M360415</link>
    <description>&lt;P&gt;I am looking for ALL of the observations in the output.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 05:34:22 GMT</pubDate>
    <dc:creator>Spintu</dc:creator>
    <dc:date>2024-02-06T05:34:22Z</dc:date>
    <item>
      <title>ERROR: The ID value occurs twice in the same BY group in Proc Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914620#M360409</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;proc transpose data=test out=want (drop=_:) prefix=o_;
var o_value;
by subject crs;
id var;
run.&lt;/CODE&gt;&lt;/PRE&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;subject&lt;/TD&gt;&lt;TD&gt;crs&lt;/TD&gt;&lt;TD&gt;var&lt;/TD&gt;&lt;TD&gt;value&lt;/TD&gt;&lt;TD&gt;o_value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;thresp&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;998&lt;/TD&gt;&lt;TD&gt;thresp&lt;/TD&gt;&lt;TD&gt;NE&lt;/TD&gt;&lt;TD&gt;NE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;998&lt;/TD&gt;&lt;TD&gt;thresp&lt;/TD&gt;&lt;TD&gt;PD&lt;/TD&gt;&lt;TD&gt;PD&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here I have attached the code and sample data. However, I am getting the below error messages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The ID value "o_tlresp" occurs twice in the same BY group.&lt;/P&gt;&lt;P&gt;can someone help me to fix this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 02:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914620#M360409</guid>
      <dc:creator>Spintu</dc:creator>
      <dc:date>2024-02-06T02:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The ID value occurs twice in the same BY group in Proc Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914622#M360411</link>
      <description>&lt;P&gt;Sure.&amp;nbsp; What output do you WANT to get in that situation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want just the FIRST (or LAST) value in the group?&amp;nbsp; If so then first get rid of the unwanted observations.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data for_transpose;
  set test;
  by subject crs var;
  if first.var;
run;
proc transpose data=for_transpose out=want (drop=_:) prefix=o_;
  var o_value;
  by subject crs;
  id var;
run.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you want ALL of the observations?&amp;nbsp; Then you need to add a new variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data for_transpose;
  set test;
  by subject crs var;
  if first.var then row=0;
  row+1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you want them to become new OBSERVATIONS? Then include the new variable in the BY statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=for_transpose out=want (drop=_:) prefix=o_;
  var o_value;
  by subject crs row;
  id var;
run.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you want them to become new VARIABLES? Then include the new variable in the ID statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=for_transpose out=want (drop=_:) prefix=o_;
  var o_value;
  by subject crs;
  id var row;
run.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2024 14:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914622#M360411</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-06T14:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The ID value occurs twice in the same BY group in Proc Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914633#M360415</link>
      <description>&lt;P&gt;I am looking for ALL of the observations in the output.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 05:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-ID-value-occurs-twice-in-the-same-BY-group-in-Proc/m-p/914633#M360415</guid>
      <dc:creator>Spintu</dc:creator>
      <dc:date>2024-02-06T05:34:22Z</dc:date>
    </item>
  </channel>
</rss>

