<?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: Create single records from multiple rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201199#M37599</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Normally you use PROC TRANSPOSE for this type of problem. You have complicated things by having multiple variables that you want to transpose together.&lt;/P&gt;&lt;P&gt;Since they are both character variables you can sort of trick it by using the first one as both a BY variable and an analysis variable in the first TRANSPOSE to make a tall skinny table. Then transpose again to make the desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ID $ q1 $ q2 $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A R1 smart&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A R3 queue&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B R3 queue&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C R1 smart&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C R4 dumb&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C R5 okay&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=have &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=tall ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; id q1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; q1 q2 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=tall &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=want &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;prefix&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=newq;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; id ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; col1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: none;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;Obs&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;ID&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;_NAME_&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq4&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq5&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq6&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;A&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;COL1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;smart&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;queue&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;B&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;COL1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;queue&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;C&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;COL1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;smart&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R4&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;dumb&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R5&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;okay&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Aug 2015 01:12:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-08-18T01:12:31Z</dc:date>
    <item>
      <title>Create single records from multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201198#M37598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Say I have a SAS dataset created by the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data try;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input ID $ q1 $ q2 $;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A R1 smart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A R3 queue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B R3 queue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C R1 smart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C R4 dumb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C R5 okay&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to create a new dataset with the following structure (where I have each ID letter on a row and all its data):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; smart&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queue&lt;/P&gt;&lt;P&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queue&lt;/P&gt;&lt;P&gt;C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; smart&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dumb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; R5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; okay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fairly new to SAS and was looking for a quick easy to understand way in how to do this. Anybody out there that can help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 20:56:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201198#M37598</guid>
      <dc:creator>inquisitive_man</dc:creator>
      <dc:date>2015-08-17T20:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create single records from multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201199#M37599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Normally you use PROC TRANSPOSE for this type of problem. You have complicated things by having multiple variables that you want to transpose together.&lt;/P&gt;&lt;P&gt;Since they are both character variables you can sort of trick it by using the first one as both a BY variable and an analysis variable in the first TRANSPOSE to make a tall skinny table. Then transpose again to make the desired output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ID $ q1 $ q2 $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A R1 smart&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A R3 queue&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B R3 queue&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C R1 smart&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C R4 dumb&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C R5 okay&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=have &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=tall ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; id q1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; q1 q2 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;transpose&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=tall &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=want &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;prefix&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=newq;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; id ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; col1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: none;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;Obs&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;ID&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;_NAME_&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq4&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq5&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-left: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;newq6&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;A&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;COL1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;smart&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;queue&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;B&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;COL1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;queue&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: solid windowtext 1.0pt; border-top: none; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;C&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;COL1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;smart&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R4&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;dumb&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;R5&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-top: none; border-left: none; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt; padding: 0 5.4pt 0 5.4pt;" valign="top" width="64"&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 8.0pt; font-family: 'SAS Monospace';"&gt;okay&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2015 01:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201199#M37599</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-18T01:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create single records from multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201200#M37600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simplest way is using proc summary.&lt;/P&gt;&lt;P&gt;Or you want check MERGE skill which has more fast speed and no need to reorder variable:&lt;/P&gt;&lt;P&gt;(me,Arthur.T, Matt)&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf" title="http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf"&gt;http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3 style="color: #353535; font-family: Lato, sans-serif; background-color: #f0f1f2;"&gt;Code: Program&lt;/H3&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;input&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;q1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;q2&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;A R1 smart&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;A R3 queue&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;B R3 queue&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;C R1 smart&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;C R4 dumb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="cards-data" style="color: #bb9905;"&gt;C R5 okay&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;max&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;into&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;group&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;summary&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;have&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;nway&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;class&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;id&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;out&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;want&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;idgroup&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;out&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;n&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;q1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;q2&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2015 12:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201200#M37600</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-08-18T12:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create single records from multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201201#M37601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the prompt feedback. Your method works perfectly but in order to name the variables appropriately all within a singular step the method outlined by @xia keshan works best for my usage. Thanks again for the insight!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 17:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201201#M37601</guid>
      <dc:creator>inquisitive_man</dc:creator>
      <dc:date>2015-08-19T17:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create single records from multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201202#M37602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your post and link to the article. It offered great insight on multiple topics. Ultimately I understand the article better than your proc summary above. Thank you again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 17:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201202#M37602</guid>
      <dc:creator>inquisitive_man</dc:creator>
      <dc:date>2015-08-19T17:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create single records from multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201203#M37603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&amp;nbsp; If you want an explanation of the PROC SUMMARY idea used by Xia, read this paper ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Transposing Data Using PROC SUMMARY'S IDGROUP Option&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings10/102-2010.pdf" title="http://support.sas.com/resources/papers/proceedings10/102-2010.pdf"&gt;http://support.sas.com/resources/papers/proceedings10/102-2010.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 19:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-single-records-from-multiple-rows/m-p/201203#M37603</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-08-19T19:25:58Z</dc:date>
    </item>
  </channel>
</rss>

