<?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 new variable based on values/rules in other columns in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522891#M4537</link>
    <description>&lt;P&gt;Rules? Data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would guess that Step 2 is summing the variable&amp;nbsp;OS from the data&amp;nbsp;coming from step 1 grouped by CIF and segment. And then some sequence is assigned within the CIF variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The summing part, if that is indeed part of the process is easy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc summary data=have nway;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class cif segment2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var OS;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=temp(drop= _type_ _freq_) sum=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;then maype&lt;/P&gt;
&lt;P&gt;Proc sort data=temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; by segment2 descending os;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; by segment2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.segment2 then Computedcolumn=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; else computedcolumn+1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will likely need other sorts to get any specific order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2018 16:10:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-12-20T16:10:54Z</dc:date>
    <item>
      <title>Create new variable based on values/rules in other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522804#M4513</link>
      <description>&lt;P&gt;I'm new in using SAS Enterprise Guide,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont know the code for Step 2 (attachment below), Computed Column is a new Column that can;t be found in other tables. Example: Computed Column = 1 for highest OS for Commercial Segment of CIF 1. Computed Column = 2 for second highest for Corporate Segmment of CIF 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really need your help.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 07:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522804#M4513</guid>
      <dc:creator>audreypingkan</dc:creator>
      <dc:date>2018-12-20T07:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create new variable based on values/rules in other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522812#M4516</link>
      <description>&lt;P&gt;Please supply your example data as data steps (see my footnotes for how to do that semi-automatically), so we can know your datasets (Maxim 3) &lt;EM&gt;as they are&lt;/EM&gt;, and not how the ***** Excel thinks they are.&lt;/P&gt;
&lt;P&gt;Then also post your code (once again, see my footnotes), so we can see what you already tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 08:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522812#M4516</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-20T08:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create new variable based on values/rules in other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522891#M4537</link>
      <description>&lt;P&gt;Rules? Data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would guess that Step 2 is summing the variable&amp;nbsp;OS from the data&amp;nbsp;coming from step 1 grouped by CIF and segment. And then some sequence is assigned within the CIF variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The summing part, if that is indeed part of the process is easy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc summary data=have nway;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class cif segment2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var OS;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=temp(drop= _type_ _freq_) sum=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;then maype&lt;/P&gt;
&lt;P&gt;Proc sort data=temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; by segment2 descending os;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; by segment2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.segment2 then Computedcolumn=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; else computedcolumn+1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will likely need other sorts to get any specific order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 16:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-new-variable-based-on-values-rules-in-other-columns/m-p/522891#M4537</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-20T16:10:54Z</dc:date>
    </item>
  </channel>
</rss>

