<?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 why  it doesn't work when i place one variable in the ID statement in proc transpose ? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739067#M80515</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = cert.trials out = transtrials1;
var cholesterol triglyc uric;
id name testdate;
run;
proc print data = transtrials1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the output like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tianerhu_0-1620160589688.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59029i54DB4EE2BCB23860/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tianerhu_0-1620160589688.png" alt="tianerhu_0-1620160589688.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = cert.trials out = transtrials1;
var cholesterol triglyc uric;
&lt;FONT color="#FF0000"&gt;id name ;&lt;/FONT&gt;
run;
proc print data = transtrials1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;please look at the red part , I place the variable name instead of the two variables 'name' and ' testdate' , and then it doesn't work , why ? &lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 20:39:11 GMT</pubDate>
    <dc:creator>tianerhu</dc:creator>
    <dc:date>2021-05-04T20:39:11Z</dc:date>
    <item>
      <title>why  it doesn't work when i place one variable in the ID statement in proc transpose ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739067#M80515</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = cert.trials out = transtrials1;
var cholesterol triglyc uric;
id name testdate;
run;
proc print data = transtrials1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the output like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tianerhu_0-1620160589688.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59029i54DB4EE2BCB23860/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tianerhu_0-1620160589688.png" alt="tianerhu_0-1620160589688.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = cert.trials out = transtrials1;
var cholesterol triglyc uric;
&lt;FONT color="#FF0000"&gt;id name ;&lt;/FONT&gt;
run;
proc print data = transtrials1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;please look at the red part , I place the variable name instead of the two variables 'name' and ' testdate' , and then it doesn't work , why ? &lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 20:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739067#M80515</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2021-05-04T20:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: why  it doesn't work when i place one variable in the ID statement in proc transpose ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739070#M80516</link>
      <description>What is the error? How does it not work?</description>
      <pubDate>Tue, 04 May 2021 20:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739070#M80516</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-04T20:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: why  it doesn't work when i place one variable in the ID statement in proc transpose ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739073#M80517</link>
      <description>&lt;P&gt;You cannot have two variables for JOHNSON.&amp;nbsp; One for the first DATE and other for the next DATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you want to move one of those two variables to a BY statement instead?&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 20:48:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739073#M80517</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-04T20:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: why  it doesn't work when i place one variable in the ID statement in proc transpose ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739090#M80518</link>
      <description>&lt;P&gt;The important thing to do is look at your LOG.&lt;/P&gt;
&lt;P&gt;ID with duplicates for the BY group are problems.&lt;/P&gt;
&lt;P&gt;Consider this small example:&lt;/P&gt;
&lt;PRE&gt;data junk;
   input x y z;
datalines;
1 2 3
1 2 4
1 2 5
2 1 3
2 2 5
;

proc transpose data=junk out=example;
   by x;
   id y;
   var z;
run;&lt;/PRE&gt;
&lt;P&gt;Which in the log for proc transpose shows:&lt;/P&gt;
&lt;PRE&gt;743     id y;
744     var z;
745  run;

ERROR: The ID value "_2" occurs twice in the same BY group.
ERROR: The ID value "_2" occurs twice in the same BY group.
NOTE: The above message was for the following BY group:
      x=1
WARNING: 1 BY groups omitted due to earlier errors.
&lt;/PRE&gt;
&lt;P&gt;Did you see a similar set of ERROR: messages for values of NAME in your second example in your log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is an option for the Proc Transpose statement, LET that allows multiple identical values for the ID variable(s).&lt;/P&gt;
&lt;P&gt;However the result is seldom what you actually want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;747  proc transpose data=junk out=example
748     let ;
749     by x;
750     id y;
751     var z;
752  run;

WARNING: The ID value "_2" occurs twice in the same BY group.
WARNING: The ID value "_2" occurs twice in the same BY group.
NOTE: The above message was for the following BY group:
      x=1
NOTE: There were 5 observations read from the data set WORK.JUNK.
NOTE: The data set WORK.EXAMPLE has 2 observations and 4 variables.
&lt;/PRE&gt;
&lt;P&gt;The duplicate values are now warnings but look at the output data set and see if it looks like what you might want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 21:49:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/why-it-doesn-t-work-when-i-place-one-variable-in-the-ID/m-p/739090#M80518</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-04T21:49:13Z</dc:date>
    </item>
  </channel>
</rss>

