<?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: Help creating a new category with info from two other columns in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744557#M29311</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/382315"&gt;@careypafford&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a data set that has a total score from an assessment and gender. I need to create a new category of, 'risk level' that will use gender and a total score range to give me a risk level. How would I set this up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: if 'gender' = M (options here are M or F) and 'total score' = 8 (I need this to be able to use a range, i.e. 0-7, 8-10,11-15, 16+) then 'risk level' (the newly created category) = Med-Low (options here are Low, Med-Low, Med-High, High)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have given us one possible outcome, but there are many other possibilities and you haven't told us what risk score would result. You haven't told us what would happen if gender='F', and you haven't told us what would happen if total_score=9, and so on. We need to see the full set of possibilities in order to provide code to compute the risk level for you.&lt;/P&gt;</description>
    <pubDate>Fri, 28 May 2021 23:31:42 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-05-28T23:31:42Z</dc:date>
    <item>
      <title>Help creating a new category with info from two other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744551#M29310</link>
      <description>&lt;P&gt;I have a data set that has a total score from an assessment and gender. I need to create a new category of, 'risk level' that will use gender and a total score range to give me a risk level. How would I set this up?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: if 'gender' = M (options here are M or F) and 'total score' = 8 (I need this to be able to use a range, i.e. 0-7, 8-10,11-15, 16+) then 'risk level' (the newly created category) = Med-Low (options here are Low, Med-Low, Med-High, High)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 22:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744551#M29310</guid>
      <dc:creator>careypafford</dc:creator>
      <dc:date>2021-05-28T22:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new category with info from two other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744557#M29311</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/382315"&gt;@careypafford&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a data set that has a total score from an assessment and gender. I need to create a new category of, 'risk level' that will use gender and a total score range to give me a risk level. How would I set this up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: if 'gender' = M (options here are M or F) and 'total score' = 8 (I need this to be able to use a range, i.e. 0-7, 8-10,11-15, 16+) then 'risk level' (the newly created category) = Med-Low (options here are Low, Med-Low, Med-High, High)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have given us one possible outcome, but there are many other possibilities and you haven't told us what risk score would result. You haven't told us what would happen if gender='F', and you haven't told us what would happen if total_score=9, and so on. We need to see the full set of possibilities in order to provide code to compute the risk level for you.&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 23:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744557#M29311</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-28T23:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new category with info from two other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744568#M29313</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/382315"&gt;@careypafford&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;While there are multiple approaches to solving your problem, with the information you have given I have the following sample code. Modify it to suit your needs&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select Name, Sex, age,
case
when Sex="M" and Age between 0 and 7 then 'LOW'
when Sex="M" and Age between 8 and 10 then 'MID-LOW'
when Sex="M" and Age between 10 and 15 then 'MID-HIGH'
when Sex="M" and Age&amp;gt; 16 then 'MID-HIGH'
 else 'NONE'
end as risk_level
from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 May 2021 01:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744568#M29313</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-29T01:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new category with info from two other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744938#M29335</link>
      <description>&lt;P&gt;The assessment breaks down as follows:&lt;/P&gt;&lt;P&gt;Low: Male: 0-7; Female: 0-10&lt;/P&gt;&lt;P&gt;Med-Low: Male: 8-10; Female: 11-13&lt;/P&gt;&lt;P&gt;Med-High: Male: 11-15; Female: 14-18&lt;/P&gt;&lt;P&gt;High: Male: 16+; Female: 19+&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 13:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744938#M29335</guid>
      <dc:creator>careypafford</dc:creator>
      <dc:date>2021-06-01T13:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating a new category with info from two other columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744940#M29336</link>
      <description>&lt;P&gt;Partial example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    length category $ 8;
    if gender='M' and total_score&amp;lt;=7 then category='Low';
    else if gender='M' and 8&amp;lt;=total_score&amp;lt;=10 then category='Med-Low';
    /* You type the rest */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Jun 2021 13:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-creating-a-new-category-with-info-from-two-other-columns/m-p/744940#M29336</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-01T13:59:05Z</dc:date>
    </item>
  </channel>
</rss>

