<?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: switch rows to column while keeping the values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956846#M373566</link>
    <description>&lt;P&gt;Having data in variable names is almost always a bad idea and leads to unnecessary complex code in further steps. "2021-05-18" is not a valid variable name. If you want a report as result using proc report with across-option for date you should get the layout.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2025 06:40:15 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2025-01-22T06:40:15Z</dc:date>
    <item>
      <title>switch rows to column while keeping the values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956831#M373564</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;
&lt;P&gt;I am a bit stick with transposing data. would really appreciate your help with codes&lt;/P&gt;
&lt;P&gt;this is what I have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="201"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="67px"&gt;TICKER&lt;/TD&gt;
&lt;TD width="70px"&gt;DATE&lt;/TD&gt;
&lt;TD width="63px"&gt;PRC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67px" style="font-weight: 400;"&gt;A&lt;/TD&gt;
&lt;TD width="70px" style="font-weight: 400;"&gt;2021-05-18&lt;/TD&gt;
&lt;TD width="63px" style="font-weight: 400;"&gt;128.75&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67px" style="font-weight: 400;"&gt;A&lt;/TD&gt;
&lt;TD width="70px" style="font-weight: 400;"&gt;2021-05-19&lt;/TD&gt;
&lt;TD width="63px" style="font-weight: 400;"&gt;130.21&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67px" style="font-weight: 400;"&gt;A&lt;/TD&gt;
&lt;TD width="70px" style="font-weight: 400;"&gt;2021-05-20&lt;/TD&gt;
&lt;TD width="63px" style="font-weight: 400;"&gt;132.15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67px" style="font-weight: 400;"&gt;AAPL&lt;/TD&gt;
&lt;TD width="70px" style="font-weight: 400;"&gt;2021-05-18&lt;/TD&gt;
&lt;TD width="63px" style="font-weight: 400;"&gt;124.85&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67px" style="font-weight: 400;"&gt;AAPL&lt;/TD&gt;
&lt;TD width="70px" style="font-weight: 400;"&gt;2021-05-19&lt;/TD&gt;
&lt;TD width="63px" style="font-weight: 400;"&gt;124.69&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67px" style="font-weight: 400;"&gt;AAPL&lt;/TD&gt;
&lt;TD width="70px" style="font-weight: 400;"&gt;2021-05-20&lt;/TD&gt;
&lt;TD width="63px" style="font-weight: 400;"&gt;127.31&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is what I want:&lt;/P&gt;
&lt;TABLE width="292"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="68px"&gt;TICKER&lt;/TD&gt;
&lt;TD width="61px"&gt;2021-05-18&lt;/TD&gt;
&lt;TD width="81px"&gt;2021-05-19&lt;/TD&gt;
&lt;TD width="81px"&gt;2021-05-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68px"&gt;A&lt;/TD&gt;
&lt;TD width="61px"&gt;128.75&lt;/TD&gt;
&lt;TD width="81px"&gt;130.21001&lt;/TD&gt;
&lt;TD width="81px"&gt;132.14999&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68px"&gt;AAPL&lt;/TD&gt;
&lt;TD width="61px"&gt;124.85&lt;/TD&gt;
&lt;TD width="81px"&gt;124.69&lt;/TD&gt;
&lt;TD width="81px"&gt;127.31&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 22 Jan 2025 03:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956831#M373564</guid>
      <dc:creator>Takdir</dc:creator>
      <dc:date>2025-01-22T03:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: switch rows to column while keeping the values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956846#M373566</link>
      <description>&lt;P&gt;Having data in variable names is almost always a bad idea and leads to unnecessary complex code in further steps. "2021-05-18" is not a valid variable name. If you want a report as result using proc report with across-option for date you should get the layout.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 06:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956846#M373566</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-01-22T06:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: switch rows to column while keeping the values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956864#M373576</link>
      <description>&lt;P&gt;For reporting purposes, use PROC REPORT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ticker $ date :yymmdd10. prc;
format date yymmdd10.;
datalines;
A 2021-05-18 128.75
A 2021-05-19 130.21
A 2021-05-20 132.15
AAPL 2021-05-18 124.85
AAPL 2021-05-19 124.69
AAPL 2021-05-20 127.31
;

proc report data=have;
column ticker prc,date;
define ticker / group;
define prc / "" analysis;
define date / "" across;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jan 2025 10:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/switch-rows-to-column-while-keeping-the-values/m-p/956864#M373576</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-01-22T10:07:57Z</dc:date>
    </item>
  </channel>
</rss>

