<?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: How to make age a categorical variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479734#M123864</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;By "treated as categories", I presume you mean the equivalent of a CLASS variable in a GLM,&amp;nbsp;or other statistical procedures.&amp;nbsp; If so, you don't have to modify the age variable.&amp;nbsp; Instead just tell your analysis/tabulation procedure to treat age as a class var.&amp;nbsp; In the GLM proc the statement would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS age;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which you would associate with the appropriate MODEL statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And if we're talking about AGE, then yes the CLASS statement would cause AGE to be treated as a categorical variable, and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218524"&gt;@toesockshoe&lt;/a&gt;, most likely this is a poor way to analyze this variable.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 21:49:04 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-07-19T21:49:04Z</dc:date>
    <item>
      <title>How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479694#M123852</link>
      <description>&lt;P&gt;I have a dataset with age ... values being like 15,16,17,...90 (all whole numbers), but sas makes this continuous (numerical). Is there a way for me to make this categorical?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 20:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479694#M123852</guid>
      <dc:creator>toesockshoe</dc:creator>
      <dc:date>2018-07-19T20:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479698#M123854</link>
      <description>&lt;P&gt;natural numbers are not continuous.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I digress.&amp;nbsp;&amp;nbsp; What categories do you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 20:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479698#M123854</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-19T20:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479699#M123855</link>
      <description>&lt;P&gt;so id want 21 to be 21 and 22 to be 22 and so on, but I just don't want them to be treated as integers. I'd like for them to be treated as different/independent groups.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 20:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479699#M123855</guid>
      <dc:creator>toesockshoe</dc:creator>
      <dc:date>2018-07-19T20:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479703#M123856</link>
      <description>&lt;P&gt;Here's one example format:&lt;/P&gt;
&lt;PRE&gt;Proc format;
value age10yr
0 - 9 =' 0-9'
10-19 ='10-19'
20-29 ='20-29'
30-39 ='30-39'
40-49 ='40-49'
50-59 ='50-59'
60-69 ='60-69'
70-79 ='70-79'
80-89 ='80-89'
90-99 ='90-99'
100-high ='100+'
;
run;&lt;/PRE&gt;
&lt;P&gt;Use the format associated with the variable in Proc Print, Freq or what have you such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Format age age10yr. ;&lt;/P&gt;
&lt;P&gt;The name of a format cannot end in a number to avoid headaches when using the notation to specify print width.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 20:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479703#M123856</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-19T20:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479707#M123858</link>
      <description>&lt;P&gt;By "treated as categories", I presume you mean the equivalent of a CLASS variable in a GLM,&amp;nbsp;or other statistical procedures.&amp;nbsp; If so, you don't have to modify the age variable.&amp;nbsp; Instead just tell your analysis/tabulation procedure to treat age as a class var.&amp;nbsp; In the GLM proc the statement would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS age;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which you would associate with the appropriate MODEL statement.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 20:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479707#M123858</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-07-19T20:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479734#M123864</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;By "treated as categories", I presume you mean the equivalent of a CLASS variable in a GLM,&amp;nbsp;or other statistical procedures.&amp;nbsp; If so, you don't have to modify the age variable.&amp;nbsp; Instead just tell your analysis/tabulation procedure to treat age as a class var.&amp;nbsp; In the GLM proc the statement would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS age;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which you would associate with the appropriate MODEL statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And if we're talking about AGE, then yes the CLASS statement would cause AGE to be treated as a categorical variable, and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218524"&gt;@toesockshoe&lt;/a&gt;, most likely this is a poor way to analyze this variable.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 21:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479734#M123864</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-19T21:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479749#M123867</link>
      <description>&lt;P&gt;As has already been mentioned, the CLASS statement does this in most cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you find a case where the CLASS statement doesn't work, just create your own categorical variable based on AGE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;agecat = put(age, z3.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use AGECAT instead of AGE in your program.&amp;nbsp; Note that AGECAT will be character (not numeric).&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 22:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479749#M123867</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-19T22:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to make age a categorical variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479757#M123872</link>
      <description>&lt;P&gt;Variables are numerical or character. A categorical variable is mostly defined by usage, but can typically be of either group. So why do you think you need a categorical variable?&lt;/P&gt;
&lt;P&gt;If this is for a regression using GLM/LOGISTIC or that form you need to place the variable in a CLASS statement or create dummy variables manually. It won't matter if it's character or numerical when creating the dummy variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218524"&gt;@toesockshoe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;so id want 21 to be 21 and 22 to be 22 and so on, but I just don't want them to be treated as integers. I'd like for them to be treated as different/independent groups.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 23:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-age-a-categorical-variable/m-p/479757#M123872</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-19T23:13:41Z</dc:date>
    </item>
  </channel>
</rss>

