<?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 how do I group age to 10 year bands in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331455#M22003</link>
    <description>&lt;P&gt;Hi all, new to the forum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the query wizard to query data rather then command line type programming.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to extract a result set that groups activity by age, but using the age field (single year) as it is results in too large a result set (long story... I'm grouping on other fields as well, that can't be simplified)). I know there is a way to group ages (ie 70-79) to simplify the outputs but I just can't work out how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm afraid I don't know what SAS EG version it is... it's not on my PC, it is a remote instance that I access via an online method. It is quite a restrictive set up, but it's the only way I can access this data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help gratefully received.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Feb 2017 10:54:55 GMT</pubDate>
    <dc:creator>jackthecat</dc:creator>
    <dc:date>2017-02-10T10:54:55Z</dc:date>
    <item>
      <title>how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331455#M22003</link>
      <description>&lt;P&gt;Hi all, new to the forum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the query wizard to query data rather then command line type programming.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to extract a result set that groups activity by age, but using the age field (single year) as it is results in too large a result set (long story... I'm grouping on other fields as well, that can't be simplified)). I know there is a way to group ages (ie 70-79) to simplify the outputs but I just can't work out how to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm afraid I don't know what SAS EG version it is... it's not on my PC, it is a remote instance that I access via an online method. It is quite a restrictive set up, but it's the only way I can access this data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help gratefully received.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 10:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331455#M22003</guid>
      <dc:creator>jackthecat</dc:creator>
      <dc:date>2017-02-10T10:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331475#M22008</link>
      <description>&lt;P&gt;Hi Try an expression like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(int((age - 1) / 10) + 1) * 10&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To test out your expression you can use a DATA Step like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  do age = 1 to 100;
    age2 = round(age, 10);
    age3 = (int((age - 1) / 10) + 1) * 10;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 12:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331475#M22008</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-02-10T12:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331490#M22009</link>
      <description>&lt;P&gt;Yes, the query builder in EG has a feature to do exactly this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. In your query, click on "Computed Columns". Select New...&lt;/P&gt;
&lt;P&gt;2. Select "Recoded column".&lt;/P&gt;
&lt;P&gt;3. Select your variable.&lt;/P&gt;
&lt;P&gt;4. In the "Specity a replacement" dialog, select "Add...". Then select "Replace a Range".&lt;/P&gt;
&lt;P&gt;5. Enter the lower limit and the upper limit for your first age group, and enter a code to replace them with (e.g. replace 0 to 10 with 1).&lt;/P&gt;
&lt;P&gt;6. Keep repeating steps 4 and 5 for all of your age groups. When you're done, select "Next".&lt;/P&gt;
&lt;P&gt;7. Give your new column a name, select "Next", and select "Finish".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you can group on this new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 13:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331490#M22009</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-02-10T13:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331514#M22015</link>
      <description>&lt;P&gt;Thanks Tom, that's exactly what I wanted : )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it's going fine as I set it up, but then throwing an error when I try to run the query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there any little quirks like the group names have to have quotes round, or can't be non numeric values, or anything like that?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331514#M22015</guid>
      <dc:creator>jackthecat</dc:creator>
      <dc:date>2017-02-10T14:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331528#M22019</link>
      <description>&lt;P&gt;When I tried it out, I used numeric group names, no quotes.I suggest you do the same, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 - 10 -&amp;gt; 1&lt;BR /&gt;11 - 20 -&amp;gt; 2&lt;BR /&gt;21 - 30 -&amp;gt; 3&lt;BR /&gt;31 - 40 -&amp;gt; 4&lt;BR /&gt;41 - 50 -&amp;gt; 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want them to have nice descriptions for reporting, you can assign a format to them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that's not it, post the log with the error message so we can take a look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331528#M22019</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-02-10T14:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331531#M22021</link>
      <description>&lt;P&gt;I occurred to me as I was looking at my last post, if your ranges are such that they can be derived from a formula, instead of using "Recoded Column" you could use the advanced expression builder with something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NewAgeVar = floor(OldAgeVar / 10)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should get to know all of the options of the Query Builder...in my opinion, it's the most powerful feature in Enterprise Guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/331531#M22021</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-02-10T14:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/332153#M22041</link>
      <description>&lt;P&gt;There it is... I had non numeric characters in the group names. Working perfectly now. Many thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 13:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/332153#M22041</guid>
      <dc:creator>jackthecat</dc:creator>
      <dc:date>2017-02-13T13:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: how do I group age to 10 year bands</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/332156#M22042</link>
      <description>&lt;P&gt;Will do : )&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 13:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-do-I-group-age-to-10-year-bands/m-p/332156#M22042</guid>
      <dc:creator>jackthecat</dc:creator>
      <dc:date>2017-02-13T13:08:18Z</dc:date>
    </item>
  </channel>
</rss>

