<?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: How to transpose from same row with multiple variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758592#M239555</link>
    <description>&lt;PRE&gt;data have;
  input ID $ Marketed $ Value1 Value2 Value3;
  datalines;
F1 A 13 207 1
F1 A 13 207 1
F1 A 13 207 1
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 C 15 208 4
F1 C 15 208 4
F2 A 19 220 8
F2 A 19 220 8
F2 B 14 210 6
F2 C 12 212 5
F3 A 15 230 10
;

proc sort data=have out=temp nodupkey;
by _all_;
run;

proc transpose data=temp out=temp1;
by id marketed;
var value: ;
run;
proc transpose data=temp1 out=want;
by id;
id _name_ marketed;
var col1;
run;&lt;/PRE&gt;</description>
    <pubDate>Sat, 31 Jul 2021 12:02:19 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-07-31T12:02:19Z</dc:date>
    <item>
      <title>How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758514#M239503</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to know how to transpose values from a table that I have to table that I want as it is described below:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD colspan="5" width="319px" height="20" class="xl63" style="height: 15.0pt; width: 240pt;"&gt;What I have&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;ID&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;Marketed&lt;/TD&gt;
&lt;TD width="63.9844px" class="xl64" style="border-top: none; border-left: none;"&gt;Value1&lt;/TD&gt;
&lt;TD width="63.9844px" class="xl64" style="border-top: none; border-left: none;"&gt;Value2&lt;/TD&gt;
&lt;TD width="65.0469px" class="xl64" style="border-top: none; border-left: none;"&gt;Value3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;13&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;207&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;13&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;207&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;13&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;207&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;205&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;205&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;205&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;205&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;208&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;208&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;19&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;220&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;19&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;220&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;B&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;14&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;210&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;C&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;212&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="42.9844px" height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;F3&lt;/TD&gt;
&lt;TD width="83px" class="xl64" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;
&lt;TD width="63.9844px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;230&lt;/TD&gt;
&lt;TD width="65.0469px" align="right" class="xl64" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, my goal is this next table below (because in the end I will transform each ID in a single line:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 480pt;" border="0" width="640" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD colspan="10" width="640" height="20" class="xl66" style="border-right: .5pt solid black; height: 15.0pt; width: 480pt;"&gt;What I want&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;ID&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value1A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value1B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value1C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value2A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value2B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value2C&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value3A&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value3B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Value3C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;13&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;207&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;205&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;208&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;19&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;14&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;220&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;210&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;212&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt; border-top: none;"&gt;F3&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;15&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;230&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 20:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758514#M239503</guid>
      <dc:creator>Moraes86</dc:creator>
      <dc:date>2021-07-30T20:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758523#M239506</link>
      <description>&lt;P&gt;Well, yes you could do this transpose, but it will make all subsequent programming much harder compared to not transposing. What is the reason you need the data transposed like this? What are you going to do with this transposed data set?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 20:47:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758523#M239506</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-30T20:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758527#M239510</link>
      <description>&lt;P&gt;Especially why the many rows of missing values?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 20:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758527#M239510</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-07-30T20:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758534#M239514</link>
      <description>I forgot to fill these rows....probably those rows would be filled with the same values</description>
      <pubDate>Fri, 30 Jul 2021 21:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758534#M239514</guid>
      <dc:creator>Moraes86</dc:creator>
      <dc:date>2021-07-30T21:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758537#M239515</link>
      <description>Yes... I understand what you mean...&lt;BR /&gt;I need to summarize these information in a single line&lt;BR /&gt;If you have another suggestion that I could use in this situation instead of Transpose.... I accept as well =D</description>
      <pubDate>Fri, 30 Jul 2021 21:15:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758537#M239515</guid>
      <dc:creator>Moraes86</dc:creator>
      <dc:date>2021-07-30T21:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758544#M239521</link>
      <description>&lt;P&gt;But you didn't answer my questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Specifically, I asked:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;What is the reason you need the data transposed like this? What are you going to do with this transposed data set?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 21:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758544#M239521</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-30T21:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758572#M239544</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/375564"&gt;@Moraes86&lt;/a&gt;&amp;nbsp;Do you need a table or a report? There will be multiple ways to get what you want. Just show us the desired end result and be clear if you need this as a table or as a report.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID $ Marketed $ Value1 Value2 Value3;
  datalines;
F1 A 13 207 1
F1 A 13 207 1
F1 A 13 207 1
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 C 15 208 4
F1 C 15 208 4
F2 A 19 220 8
F2 A 19 220 8
F2 B 14 210 6
F2 C 12 212 5
F3 A 15 230 10
;

proc sql;
  select 
    id,
    marketed,
    sum(value1) as sum_value1,
    sum(value2) as sum_value2,
    sum(value3) as sum_value3
  from have
  group by
    id,
    marketed
  ;
quit;

options missing=' ';
proc tabulate data=have;
  class id Marketed;
  var value1 value2 value3;
  keylabel sum=' ';
  table
    id,
    Marketed*
      (value1 value2 value3)*f=16.
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1627696734506.png" style="width: 546px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62162i9B80FA9ABFA4073F/image-dimensions/546x429?v=v2" width="546" height="429" role="button" title="Patrick_0-1627696734506.png" alt="Patrick_0-1627696734506.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 02:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758572#M239544</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-31T02:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758577#M239547</link>
      <description>&lt;P&gt;Another solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data temp;
set have; by id marketed notsorted;
array v value:;
if first.marketed;
length var $32;
do i = 1 to dim(v);
    var = cats(vname(v{i}), marketed);
    val = v{i};
    output;
    end;
keep id marketed var val;
run;

proc sort data=temp; by id var; run;

proc transpose data=temp out=want(drop=_name_);
by id;
var val;
id var;
run;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PGStats_0-1627704061722.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62163i9906218EFCE5E496/image-size/large?v=v2&amp;amp;px=999" role="button" title="PGStats_0-1627704061722.png" alt="PGStats_0-1627704061722.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 04:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758577#M239547</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-07-31T04:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758592#M239555</link>
      <description>&lt;PRE&gt;data have;
  input ID $ Marketed $ Value1 Value2 Value3;
  datalines;
F1 A 13 207 1
F1 A 13 207 1
F1 A 13 207 1
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 C 15 208 4
F1 C 15 208 4
F2 A 19 220 8
F2 A 19 220 8
F2 B 14 210 6
F2 C 12 212 5
F3 A 15 230 10
;

proc sort data=have out=temp nodupkey;
by _all_;
run;

proc transpose data=temp out=temp1;
by id marketed;
var value: ;
run;
proc transpose data=temp1 out=want;
by id;
id _name_ marketed;
var col1;
run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Jul 2021 12:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758592#M239555</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-31T12:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758600#M239557</link>
      <description>&lt;P&gt;If you know in advance the list of marketing codes, then you can create a 2-ways matrix, with one column per marketing code, and 1 row for each original VALUE variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Associate that matrix with the desired variable names, and it's just a matter of copying data to the matrix:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID $ Marketed $ Value1 Value2 Value3;
  datalines;
F1 A 13 207 1
F1 A 13 207 1
F1 A 13 207 1
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 B 18 205 3
F1 C 15 208 4
F1 C 15 208 4
F2 A 19 220 8
F2 A 19 220 8
F2 B 14 210 6
F2 C 12 212 5
F3 A 15 230 10
;

data want (drop=_: marketed value1-value3);
  do until (last.id);
    set have;
    by id;
  array values {3,3}   Value1A Value1B Value1C
                       Value2A Value2B Value2C
                       Value3A Value3B Value3C ;

  array orig {3} value1-value3;
    select (marketed);
      when ('A') _column=1;
      when ('B') _column=2;
      when ('C') _column=3;
    end;
    do _row=1 to 3; values{_row,_column}=orig{_row}; end;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 20:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758600#M239557</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-07-31T20:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758604#M239559</link>
      <description>&lt;P&gt;Why does the input data have repeating observations with the exact same values?&lt;/P&gt;
&lt;P&gt;And where do those repeating values go?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain and provide detailed results that match exactly what you want from the given example input.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 18:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/758604#M239559</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-31T18:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose from same row with multiple variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/760477#M240480</link>
      <description>Thanks all for the valuable help!</description>
      <pubDate>Mon, 09 Aug 2021 21:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-from-same-row-with-multiple-variables/m-p/760477#M240480</guid>
      <dc:creator>Moraes86</dc:creator>
      <dc:date>2021-08-09T21:27:50Z</dc:date>
    </item>
  </channel>
</rss>

