<?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: Categorizing huge amount of variables in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433463#M13420</link>
    <description>&lt;P&gt;And lets say I have a table where I keep conditions using which i have to cateogrize?&lt;/P&gt;&lt;P&gt;Like I have table in this format:&lt;/P&gt;&lt;P&gt;Category Condition&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;not missing(variable_name) and variable_name&amp;lt;=20&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&amp;lt;variable_name &amp;lt;=40&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&amp;lt;variable_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then based on the column condition I would categorize those values.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Feb 2018 10:31:50 GMT</pubDate>
    <dc:creator>pokepim</dc:creator>
    <dc:date>2018-02-02T10:31:50Z</dc:date>
    <item>
      <title>Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429465#M13271</link>
      <description>&lt;P&gt;Hi I have a dataset consiting of large amount of variables (50+)&lt;/P&gt;&lt;P&gt;Some of those variables are text and some of them are numeric. I want to categorize every of those variables into 2 or 3 categories. So lets say the second column of my dataset which is age would be categorized into young (age&amp;lt;25) older (25&amp;lt;age&amp;lt;40) oldest (age&amp;gt;40).&lt;/P&gt;&lt;P&gt;Another variable which is gender would be categorized into male and female. And the third is number of cars (0=none, 1 car= 1, 2+ cars= multiple) and so on.&lt;/P&gt;&lt;P&gt;So the thing is every variable woud require writing different categorization criteria which will result in&amp;nbsp;a quite long code if done manually.&lt;/P&gt;&lt;P&gt;I was thinking of creating a table where I would put a criteria how every variable should be split and then create conditions based on that. But I am not sure if it is the simplest approach&amp;nbsp;and maybe you can give me some insight how to deal with this problem.&lt;/P&gt;&lt;P&gt;BTW im on SAS 9.4.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 13:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429465#M13271</guid>
      <dc:creator>pokepim</dc:creator>
      <dc:date>2018-01-21T13:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429472#M13273</link>
      <description>&lt;P&gt;Take a look at formats. They can do a very nice job of recoding data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example for Age, but you could use the same for all of the other variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input Age;
	cards;
1
15
24
25
39
40
41
89
;
run;

proc format;
	value Agef
		low-24 = "Young"
		25-39 = "Older"
		40-high = "Oldest"
	;
run;

data want;
	set have;
	length AgeReformat $20;
	AgeReformat = put(Age, Agef.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 21 Jan 2018 20:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429472#M13273</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-01-21T20:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429476#M13274</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15142"&gt;@TomKari&lt;/a&gt;&amp;nbsp;but, depending upon what you want to do, you likely don't have to create new variables .. just create and apply the formats. e.g., using Tom's example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
	input Age;
	cards;
1
15
24
25
39
40
41
89
run;

proc format;
	value Agef
		low-24 = "Young"
		25-39 = "Older"
		40-high = "Oldest"
	;
run;

data want;
	set have;
	format Age Agef.;
run;

proc freq data=want;
  tables age;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 16:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429476#M13274</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-01-21T16:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429487#M13280</link>
      <description>Tom, I edited your post only to see if the text highlighting could be corrected. Apparently not &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Sun, 21 Jan 2018 20:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/429487#M13280</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-21T20:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/431177#M13364</link>
      <description>&lt;P&gt;You'll have to define the character categories yourself. Formats are a good option to do this as explained.&lt;/P&gt;
&lt;P&gt;For numerics, this may be a good option to automate the intervals if you only want counts:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc summary data=SASHELP.CLASS ; 
  var _numeric_  ;
  output out=SUM min= p25= p50= p75= max= /autoname;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 04:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/431177#M13364</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-01-26T04:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433463#M13420</link>
      <description>&lt;P&gt;And lets say I have a table where I keep conditions using which i have to cateogrize?&lt;/P&gt;&lt;P&gt;Like I have table in this format:&lt;/P&gt;&lt;P&gt;Category Condition&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;not missing(variable_name) and variable_name&amp;lt;=20&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&amp;lt;variable_name &amp;lt;=40&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&amp;lt;variable_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then based on the column condition I would categorize those values.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 10:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433463#M13420</guid>
      <dc:creator>pokepim</dc:creator>
      <dc:date>2018-02-02T10:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433464#M13421</link>
      <description>Is it possible to parse conditions from another table and then use them to create format? As I have this kind of table created before and Im required to use it:&lt;BR /&gt;&lt;BR /&gt;Category Condition&lt;BR /&gt;1 not missing(variable_name) and variable_name&amp;lt;=20&lt;BR /&gt;2 20&amp;lt;variable_name &amp;lt;=40&lt;BR /&gt;3 40&amp;lt;variable_name&lt;BR /&gt;&lt;BR /&gt;Then based on the column condition I would categorize those values.</description>
      <pubDate>Fri, 02 Feb 2018 10:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433464#M13421</guid>
      <dc:creator>pokepim</dc:creator>
      <dc:date>2018-02-02T10:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing huge amount of variables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433522#M13430</link>
      <description>&lt;P&gt;Yes, you can create formats from a table. See, e.g.,&amp;nbsp;&lt;SPAN&gt;www2.sas.com/proceedings/forum2007/068-2007.pdf&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then you can apply the same format(s) to as many variables as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 13:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Categorizing-huge-amount-of-variables/m-p/433522#M13430</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-02-02T13:58:07Z</dc:date>
    </item>
  </channel>
</rss>

