<?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: Breaking a Row Into Two Different Rows based on Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949644#M371439</link>
    <description>&lt;P&gt;Thank you, Paige. Is there a way to do this without creating new column names? There are other programs that have data in the same column and I would like to maintain that.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 18:35:25 GMT</pubDate>
    <dc:creator>E_W</dc:creator>
    <dc:date>2024-10-31T18:35:25Z</dc:date>
    <item>
      <title>Breaking a Row Into Two Different Rows based on Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949628#M371434</link>
      <description>&lt;P&gt;There was recently a change in methodology in how certain programs are categorized. What was before something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;County&amp;nbsp; &amp;nbsp;State&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Program&amp;nbsp; &amp;nbsp;Category&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Revenue&amp;nbsp; &amp;nbsp;Cost&amp;nbsp; &amp;nbsp; Profit&lt;/P&gt;&lt;P&gt;Drew&amp;nbsp; &amp;nbsp; &amp;nbsp; Arkansas&amp;nbsp; &amp;nbsp; &amp;nbsp; P23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Grass Seeds&amp;nbsp; &amp;nbsp; $100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $80&amp;nbsp; &amp;nbsp; &amp;nbsp; $20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has now been divided into two different categories that split the revenue, cost, and profit between the two at predetermined ratios. For P23, it would be 25% towards Wild Grass Seeds and 75% towards Grass/Legume Seeds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;County&amp;nbsp; &amp;nbsp;State&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Program&amp;nbsp; &amp;nbsp;Category&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Revenue&amp;nbsp; &amp;nbsp;Cost&amp;nbsp; &amp;nbsp; Profit&lt;/P&gt;&lt;P&gt;Drew&amp;nbsp; &amp;nbsp; &amp;nbsp; Arkansas&amp;nbsp; &amp;nbsp; &amp;nbsp; P23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Wild Grass Seeds&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $25&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $20&amp;nbsp; &amp;nbsp; &amp;nbsp; $5&lt;/P&gt;&lt;P&gt;Drew&amp;nbsp; &amp;nbsp; &amp;nbsp; Arkansas&amp;nbsp; &amp;nbsp; &amp;nbsp; P23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Grass/Legume Seeds&amp;nbsp; &amp;nbsp; &amp;nbsp;$75&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $60&amp;nbsp; &amp;nbsp; &amp;nbsp; $15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the function or code needed to trawl through the existing dataset and replace all the existing P23's with the new Categories and figures while keeping other columns like County and State intact? Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 17:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949628#M371434</guid>
      <dc:creator>E_W</dc:creator>
      <dc:date>2024-10-31T17:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking a Row Into Two Different Rows based on Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949635#M371435</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    length category $ 40;
    set have;
    if program='P23' then do;
        category='Wild Grass Seeds';
        revenue1=revenue*0.25;
        cost1=cost*0.25;
        profit1=profit*0.25;
        output;
        category='Grass/Legume Seeds';
        revenue1=revenue*0.75;
        cost1=cost*0.75;
        profit1=profit*0.75;
        output;
    end;
    else output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2024 17:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949635#M371435</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-10-31T17:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking a Row Into Two Different Rows based on Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949644#M371439</link>
      <description>&lt;P&gt;Thank you, Paige. Is there a way to do this without creating new column names? There are other programs that have data in the same column and I would like to maintain that.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 18:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949644#M371439</guid>
      <dc:creator>E_W</dc:creator>
      <dc:date>2024-10-31T18:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking a Row Into Two Different Rows based on Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949662#M371445</link>
      <description>&lt;P&gt;Maybe like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   length category $ 40;
   set have;
   if program='P23' then do;
      _revenue =  revenue;
      _cost    =  cost;
      _profit  =  profit;  

      category =  'Wild Grass Seeds';
      revenue  =  _revenue*0.25;
      cost     =  _cost*0.25;
      profit   =  _profit*0.25;
      output;
      category =  'Grass/Legume Seeds';
      revenue  =  _revenue*0.75;
      cost     =  _cost*0.75;
      profit   =  _profit*0.75;
      output;
      end;
   else output;
   drop _:;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Oct 2024 21:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949662#M371445</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2024-10-31T21:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking a Row Into Two Different Rows based on Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949665#M371448</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/415874"&gt;@E_W&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, Paige. Is there a way to do this without creating new column names? There are other programs that have data in the same column and I would like to maintain that.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;After you create a data set with the new column names, you can move the values into the old column names and then delete the new column names.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 21:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Breaking-a-Row-Into-Two-Different-Rows-based-on-Variable/m-p/949665#M371448</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-10-31T21:22:34Z</dc:date>
    </item>
  </channel>
</rss>

