<?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: Proc Transpose - Repeated Values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52603#M14486</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data test;
&amp;nbsp;&amp;nbsp; input teacher:$10. grade :$1. name :$8.;
&amp;nbsp;&amp;nbsp; cards;
Teacher1 A Tom 
Teacher1 A Harry 
Teacher1 B Ron 
Teacher2 A Neval 
;;;;
&amp;nbsp;&amp;nbsp; run;
proc sql noprint;
 select distinct cats('test(where=(teacher="',teacher,'" and grade="',grade,'") rename=(name=',grade,'))') into : list separated by ' '
&amp;nbsp; from test;
quit;
%put &amp;amp;list;
data want(drop=grade);
 merge &amp;amp;list ;
 by teacher;
 output;
 call missing(of _all_);
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Feb 2012 04:13:44 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-02-14T04:13:44Z</dc:date>
    <item>
      <title>Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52595#M14478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I have the following table&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Teacher&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Score&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Student&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Tom&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Harry&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher1&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;Ron&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher2&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;Neval&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to transpose it in this manner:&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 19.35%; height: 116px; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Teacher&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;A's&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;B's&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher1&lt;/TD&gt;&lt;TD&gt;Tom&lt;/TD&gt;&lt;TD&gt;Ron&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher1&lt;/TD&gt;&lt;TD&gt;Harry&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Teacher2&lt;/TD&gt;&lt;TD&gt;Neval&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Howerever, Proc Transose sends and error as ID (score) has duplicates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone help me to write a proc code so that when the repeatation happends, the entry must be moved to the next row (as in the second one)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanking you in advance,&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;Jijil Ramakrishnan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 10:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52595#M14478</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2012-02-13T10:21:19Z</dc:date>
    </item>
    <item>
      <title>Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52596#M14479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it doesn't matter which people get paired, as long as they are on the currect teacher/grade columns and variables, then you could use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input (Teacher Score Student) ($);&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Teacher1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Tom&lt;/P&gt;&lt;P&gt;Teacher1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Harry&lt;/P&gt;&lt;P&gt;Teacher1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Ron&lt;/P&gt;&lt;P&gt;Teacher2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Neval&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a (keep=Teacher A) b (keep=Teacher B);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if Score eq "A" then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=Student;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b='ZZZZZZZZ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if Score eq "B" then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; b=Student;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a='ZZZZZZZZ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by teacher a;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by teacher b;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if catt(a,b) ne 'ZZZZZZZZZZZZZZZZ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; if a eq 'ZZZZZZZZ' then call missing(a);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if b eq 'ZZZZZZZZ' then call missing(b);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 13:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52596#M14479</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-13T13:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52597#M14480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you willing to create one more variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;dm&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'clear log; clear output;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; teacher:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;$10.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; grade :&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;$1.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; name :&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: teal; font-family: 'Courier New'; background-color: white;"&gt;$8.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;Teacher1 A Tom &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;Teacher1 A Harry &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;Teacher1 B Ron &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: #ffffc0;"&gt;Teacher2 A Neval &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; teacher grade name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; teacher grade;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; first.grade &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; index=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; index +&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; teacher index grade;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;transpose&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=test &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;=want(drop=_name_);;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; teacher index;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;id&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; grade;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 14:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52597#M14480</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-13T14:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52598#M14481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;JAR,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an approach that is deceptively short.&amp;nbsp; You have to understand some of the inner workings of the DATA step.&amp;nbsp; In this case, you'll get a note about a many-to-many merge.&amp;nbsp; It's harmless this time, but may not be in other DATA steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; merge original (rename=(student=A) where=(score='A'))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; original (rename=(student=B) where=(score='B'));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by teacher;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; A = ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; B = ' ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the replies so far are relying on your data containing just A and B.&amp;nbsp; All could be extended to handle other values as well.&amp;nbsp; But it's a harder problem to tackle if you don't know the values of SCORE ahead of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 14:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52598#M14481</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-13T14:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52599#M14482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Data _null_,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why did you use ';;;;' instead of ';'? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 14:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52599#M14482</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-02-13T14:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52600#M14483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linlin: a lot of people use ;;;; instead of ; to end a cards, datalines, cards4 or datalines4 section as they are needed for cards4 and datalines4 and don't pose a problem for the other two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cards4 and Datalines4 are necessary when the input contains a semi-colon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 15:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52600#M14483</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-13T15:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52601#M14484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I like to be VERY careful. :smileygrin:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 15:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52601#M14484</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-13T15:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52602#M14485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thank you Art and Data _null_!&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 15:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52602#M14485</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-02-13T15:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52603#M14486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data test;
&amp;nbsp;&amp;nbsp; input teacher:$10. grade :$1. name :$8.;
&amp;nbsp;&amp;nbsp; cards;
Teacher1 A Tom 
Teacher1 A Harry 
Teacher1 B Ron 
Teacher2 A Neval 
;;;;
&amp;nbsp;&amp;nbsp; run;
proc sql noprint;
 select distinct cats('test(where=(teacher="',teacher,'" and grade="',grade,'") rename=(name=',grade,'))') into : list separated by ' '
&amp;nbsp; from test;
quit;
%put &amp;amp;list;
data want(drop=grade);
 merge &amp;amp;list ;
 by teacher;
 output;
 call missing(of _all_);
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 04:13:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52603#M14486</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-02-14T04:13:44Z</dc:date>
    </item>
    <item>
      <title>Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52604#M14487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code is astounding! It worked perfectly. &lt;/P&gt;&lt;P&gt;There is some sort of elegance in this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Mr. Atounding!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder how would you have dealt with it, if the scores are not predetermined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jijil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 13:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52604#M14487</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2012-02-14T13:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose - Repeated Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52605#M14488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jijil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp; If the scores are not predetermined, macro language gets involved.&amp;nbsp; (I didn't check data_null_'s approach, but it might work for "normal" scores.&amp;nbsp; It would run into trouble if the same data set had scores of both $ and # because the ID statement in PROC TRANSPOSE would try to create a variable named _ for both of those.&amp;nbsp; A similar issue would arise if the data contained both A+ and A-.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The details might be burdensome, but this is the approach I would take.&amp;nbsp; Capture a list of distinct values for SCORE.&amp;nbsp; (Be careful not to overcount if any of the SCORE values actually contains an embedded blank, such as A +.)&amp;nbsp; Use two sets of loops in macro language to generate SCORE_01 - SCORE_nn as needed and to label them appropriately.&amp;nbsp; For example, in the MERGE statement, one iteration through the loop would generate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;original (rename=(student=score_01) where=(score="&amp;amp;first_value_found"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use a second loop through the same values later, to generate labels, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;label score_01 = "Score was &amp;amp;first_value_found");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even that might be a hair too simple if any of the original SCORE values contain double quotes, but that's the idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 14:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Transpose-Repeated-Values/m-p/52605#M14488</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-14T14:24:45Z</dc:date>
    </item>
  </channel>
</rss>

