<?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: creating column for each of value in variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427987#M105611</link>
    <description>i guess i did not select RTF format while posting query. I have re-edited post. Hope now its clear enough to understand</description>
    <pubDate>Tue, 16 Jan 2018 12:49:54 GMT</pubDate>
    <dc:creator>Attyslogin</dc:creator>
    <dc:date>2018-01-16T12:49:54Z</dc:date>
    <item>
      <title>creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427985#M105609</link>
      <description>&lt;P&gt;Lets say i have data in following manner,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Category Sub-category month value&lt;/P&gt;&lt;P&gt;X A jan 10&lt;/P&gt;&lt;P&gt;X B jan 20&lt;/P&gt;&lt;P&gt;X C jan 30&lt;/P&gt;&lt;P&gt;X A feb 40&lt;/P&gt;&lt;P&gt;X B feb 50&lt;/P&gt;&lt;P&gt;X C feb 60&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want an output to be created something like below. Going forward if month gets added in previous datset i.e. month automatically following output populate third column for that particular month. I have already explored related few links but couldnt implement. Kindly revert with tested code. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Category Sub-category Jan Feb&lt;/P&gt;&lt;P&gt;X A 10 40&lt;/P&gt;&lt;P&gt;X B 20&amp;nbsp;&lt;SPAN style="line-height: 20px;"&gt;50&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;X C 30 60&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 12:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427985#M105609</guid>
      <dc:creator>Attyslogin</dc:creator>
      <dc:date>2018-01-16T12:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427986#M105610</link>
      <description>&lt;P&gt;Can you provide some example of what your data structure looks like?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 12:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427986#M105610</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-16T12:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427987#M105611</link>
      <description>i guess i did not select RTF format while posting query. I have re-edited post. Hope now its clear enough to understand</description>
      <pubDate>Tue, 16 Jan 2018 12:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427987#M105611</guid>
      <dc:creator>Attyslogin</dc:creator>
      <dc:date>2018-01-16T12:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427991#M105614</link>
      <description>&lt;P&gt;What you are talking about is transposing.&amp;nbsp; Unless there is a good reason to do so, e.g. for a report, don't.&amp;nbsp; And even then consider quite carefully, what happens after december for instance.&amp;nbsp; Anyways a two step approach (note no code provided - post test data in the form of a datastep - I am not here to type in that data):&lt;/P&gt;
&lt;P&gt;1) proc means or sql to roll all your data up into cat, sub, month, and sum(value)&lt;/P&gt;
&lt;P&gt;2) proc transpose that data based on cat, sub, var=sum(value), id month.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 12:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427991#M105614</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-16T12:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427995#M105615</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88783"&gt;@Attyslogin&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Lets say i have data in following manner,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;Kindly revert with &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;tested&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; code. Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;tested&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; code (&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;bold-underline-italics&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; are mine)? How about providing some data on which to test the code?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 13:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427995#M105615</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-01-16T13:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427997#M105616</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88783"&gt;@Attyslogin&lt;/a&gt; wrote:&lt;BR /&gt; Kindly revert with tested code. Thanks
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Kindly revert with example data in a data step. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 13:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/427997#M105616</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-16T13:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: creating column for each of value in variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/428016#M105620</link>
      <description>&lt;P&gt;A standard approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;by category subcategory;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc transpose data=have;&lt;/P&gt;
&lt;P&gt;by category subcategory;&lt;/P&gt;
&lt;P&gt;id month;&lt;/P&gt;
&lt;P&gt;var value;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The warnings you received from others are valid.&amp;nbsp; This program might be suitable for reporting purposes.&amp;nbsp; But for other purposes, learn how to process the data in its current form.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 14:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-column-for-each-of-value-in-variable/m-p/428016#M105620</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-16T14:23:20Z</dc:date>
    </item>
  </channel>
</rss>

