title: ERROR: The ID value "xxxxxxxxxxxx" occurs twice in the same BY group. when transposing a complex dataset
body: <p>I have a strange data set and I am hoping you all can help me. I have a data set of the levels of certain environmental contaminants which are measured multiple ways along with the limit of detection are present in a group of research participants. I need these in a wide format, but unfortunately they are currently long and the naming conventions don’t easily translate. </p>
  
  <p>This is what it looks like now:</p>
  
  <pre><code>ID   Class      Name    Weight Amount_lipids Amount_plasma LOD 
  
  
  1   AAA Lead    1.55    44.0         10.0      5.00
  1   AAB Mercury 1.55    222.0        100.0     75.00
  2   AAA Lead    1.25    25.5         12.0      5.00
  </code></pre>
  
  <p>I have tried various forms of Proc Transpose with no luck and this seems to be more complex than what specifying a prefix can handle.</p>
  
  <p>I want it to look like this:</p>
  
  <pre><code>
  ID Weight Lead_lip Lead_plas Lead_LOD Mercury_lip Mercury_plas Mercury_LOD
  1  1.55   44.0     10.0       5.0     222.0   100.0        75.0
  2  1.25   25.5     12.0       5.0     .           .        .
  </code></pre>
  
  <p>I tried a two step transpose process but received the following error ERROR: The ID value "xxxxxxxxxxxx" occurs twice in the same BY group</p>
  
  <pre><code>  by id weight name;
  run;
  
  proc transpose data=want_intermediate out=want;
    by id weight;
    id name _name_;
  run;
  
  </code></pre>