<?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: Combine multiple age group into two groups in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544728#M7921</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   if age&amp;gt;65 then AgeGroup='Above 65';
   else AgeGroup='Below 65';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Mar 2019 23:04:55 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-03-20T23:04:55Z</dc:date>
    <item>
      <title>Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544727#M7920</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I combine multiple age people into two groups?? Lower than 65 and above 65?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 23:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544727#M7920</guid>
      <dc:creator>SChander1</dc:creator>
      <dc:date>2019-03-20T23:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544728#M7921</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   if age&amp;gt;65 then AgeGroup='Above 65';
   else AgeGroup='Below 65';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2019 23:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544728#M7921</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-20T23:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544737#M7922</link>
      <description>&lt;P&gt;this code shows me error. I have used&lt;/P&gt;&lt;P&gt;data xyz;&lt;/P&gt;&lt;P&gt;set tyy;&lt;/P&gt;&lt;P&gt;if age &amp;lt;= 65 then age1= 1;&lt;/P&gt;&lt;P&gt;if age &amp;gt; 65 then age1 = 0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and its working.. thanks for your prompt response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 23:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544737#M7922</guid>
      <dc:creator>SChander1</dc:creator>
      <dc:date>2019-03-20T23:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544743#M7923</link>
      <description>&lt;P&gt;well the request did not say which group age 65 belonged to.&lt;/P&gt;
&lt;P&gt;The original requested says lower that 65 and above 65.&lt;/P&gt;
&lt;P&gt;so both are correct in the fact that the request was not questioned due to undefined requirements for which group age 65 belonged to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 00:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544743#M7923</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-03-21T00:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544752#M7924</link>
      <description>&lt;P&gt;You should consider using IF and ELSE, instead of two IF statements.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This way, if one condition is true, the second will not be tested and its more efficient. This also means that you're less likely to accidentally overwrite your values later on when you get into more complex IF/THEN logic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if age &amp;lt;= 65 then age1= 1;
&lt;FONT size="5" color="#800080"&gt;&lt;STRONG&gt;else&lt;/STRONG&gt; &lt;/FONT&gt;if age &amp;gt; 65 then age1 = 0;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267351"&gt;@SChander1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;this code shows me error. I have used&lt;/P&gt;
&lt;P&gt;data xyz;&lt;/P&gt;
&lt;P&gt;set tyy;&lt;/P&gt;
&lt;P&gt;if age &amp;lt;= 65 then age1= 1;&lt;/P&gt;
&lt;P&gt;if age &amp;gt; 65 then age1 = 0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and its working.. thanks for your prompt response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Thu, 21 Mar 2019 01:24:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544752#M7924</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-21T01:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544791#M7934</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267351"&gt;@SChander1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;this code shows me error. I have used&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;data xyz;&lt;/P&gt;
&lt;P&gt;set tyy;&lt;/P&gt;
&lt;P&gt;if age &amp;lt;= 65 then age1= 1;&lt;/P&gt;
&lt;P&gt;if age &amp;gt; 65 then age1 = 0;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and its working.. thanks for your prompt response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please post the error-message you got. The code posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; seems to be error-free.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 10:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544791#M7934</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-21T10:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple age group into two groups</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544884#M7954</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267351"&gt;@SChander1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can I combine multiple age people into two groups?? Lower than 65 and above 65?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;90% or time or more when I need such, grouping on a single value, I use a custom format. Reasons: I can change or use a different format and do not need to change the data set at all, the code for ensuring non-overlapping ranges in the format code is usually much simpler.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;/* create a data set with some age groups*/
data example;
   do age = 1 to 85;
      do j= 1 to rand('integer',2,6);
      output;
      end;
   end;
run;

proc format library = work;
value age65_
1 - 65 = '65&amp;lt;'
65&amp;lt;-high = '65+'
;
value age10yr
1 -10= ' 1-10'
11-20= '11-20'
21-30= '21-30'
31-40= '31-40'
41-50= '41-50'
51-60= '51-60'
61-70= '61-70'
71-80= '71-80'
81-high='81+'
;

proc freq data=example;
   tables age;
   format age age65_.;
run;
proc freq data=example;
   tables age;
   format age age10yr.;
run;
&lt;/PRE&gt;
&lt;P&gt;The first data set is to build a data set with a number of age values. Then two formats to group age. I actually have more than a dozen of such with other values such as "out of range" because my users have different boundary ages for their processes.&lt;/P&gt;
&lt;P&gt;Note that a format definition name cannot end in a numeral because formats usage allows specifying the number of display characters at run time such as:&lt;/P&gt;
&lt;PRE&gt;proc freq data=example;
   tables age;
   format age age10yr2.;
run;&lt;/PRE&gt;
&lt;P&gt;which shows the lower bound of the age group only.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Almost all of the analysis, graphing and reporting procedures will support groups created by a format.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 14:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-multiple-age-group-into-two-groups/m-p/544884#M7954</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-21T14:50:12Z</dc:date>
    </item>
  </channel>
</rss>

