<?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: Creating a 5 level categorical variable. in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793646#M38897</link>
    <description>anywhere after the input data set (mod4_2) is created.</description>
    <pubDate>Mon, 31 Jan 2022 22:33:36 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2022-01-31T22:33:36Z</dc:date>
    <item>
      <title>Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793629#M38886</link>
      <description>&lt;P&gt;I was asked to make a 5 categorical variable and was able to find another forum that answered questions about making one, however, am having trouble applying it to my code. The first question is the following:&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Use the UNIVARIATE procedure to find the quintile (5-level) cut-points for the variable WEIGHT.&lt;BR /&gt;Using these cut-points, create a 5-level categorical variable called WTQUINT in a dataset called&lt;BR /&gt;MOD4_1 created using the TEMP6 dataset we left off with earlier. Run a FREQ procedure on this&lt;BR /&gt;variable.;&lt;/PRE&gt;&lt;P&gt;The following is my code that I thought was ok:&lt;/P&gt;&lt;PRE&gt;PROC UNIVARIATE DATA=temp6;&lt;BR /&gt;VAR WEIGHT;&lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;DATA MOD4_1;&lt;BR /&gt;SET Temp6;&lt;BR /&gt;IF 0 &amp;lt; WEIGHT &amp;lt;= 135 THEN WTQUINT=0;&lt;BR /&gt;IF WEIGHT &amp;gt; 135 THEN WTQUINT=1;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC FREQ;&lt;BR /&gt;TABLES WTQUINT;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC UNIVARIATE DATA=MOD4_1;&lt;BR /&gt;VAR WEIGHT;&lt;BR /&gt;OUTPUT OUT=CUTPTS PCTLPTS= .20 .40 .60 .80 PCTLPRE = P_;&lt;BR /&gt;RUN; &lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA= CUTPTS;&lt;BR /&gt;RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The second question is the following:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;*2. Use the RANK procedure to create a 5-level categorical variable called WTQUINT2 in a dataset called&lt;BR /&gt;MOD4_2 from the dataset MOD4_1.&lt;/PRE&gt;&lt;P&gt;How do I create a ranking system if my obs values are 94, 94, 95, 95? I'm guessing I messed up when making my 5 categorical variable. I took 1/5, 2/5, 3/5, 4/5 out of 100% to get .20, .40. .60, .80 in my code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 21:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793629#M38886</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-01-31T21:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793630#M38887</link>
      <description>&lt;P&gt;Use the GROUPS=x option in PROC RANK to create a variable with x levels based on percentiles.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 21:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793630#M38887</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-01-31T21:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793633#M38889</link>
      <description>PROC RANK DATA=mod4_2 OUT=TWO GROUPS=X;&lt;BR /&gt;VAR WEIGHT;&lt;BR /&gt;RANKS WTQUINT2;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;this?</description>
      <pubDate>Mon, 31 Jan 2022 21:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793633#M38889</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-01-31T21:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793636#M38890</link>
      <description>&lt;P&gt;Well no, you don't use X, you use the actual number of groups (or levels) you want.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 22:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793636#M38890</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-31T22:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793637#M38891</link>
      <description>Specify GROUPS=5</description>
      <pubDate>Mon, 31 Jan 2022 22:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793637#M38891</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-01-31T22:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793638#M38892</link>
      <description>&lt;P&gt;Yes I can see that. I guess what I should clarify is that i'm getting blank results when I use the code:&lt;BR /&gt;PROC RANK DATA=mod4_2 OUT=TWO GROUPS=5;&lt;BR /&gt;VAR WEIGHT;&lt;BR /&gt;RANKS WTQUINT2;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;Because my obs values from the first part of the question is&lt;BR /&gt;P_0_2= 94&lt;BR /&gt;P_0_4= 94&lt;BR /&gt;P_0_6=95&lt;BR /&gt;P_0_8=95&lt;BR /&gt;&lt;BR /&gt;So my ranking isnt working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I had to do the following before ranking:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA MOD4_2;&lt;BR /&gt;SET MOD4_1;&lt;BR /&gt;IF WEIGHT &amp;gt; 0 AND WEIGHT &amp;lt;= 94 THEN WTQUINT2=0;&lt;BR /&gt;IF WEIGHT &amp;gt; 94 AND WEIGHT &amp;lt;= 95 THEN WTQUINT2=1;&lt;BR /&gt;RUN;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jan 2022 22:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793638#M38892</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-01-31T22:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793640#M38893</link>
      <description>It doesn't produce printed output. Look at the contents of the created data set - TWO</description>
      <pubDate>Mon, 31 Jan 2022 22:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793640#M38893</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-01-31T22:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793643#M38894</link>
      <description>So,&lt;BR /&gt;PROC RANK DATA=mod4_2 OUT=FOUR GROUPS=5;&lt;BR /&gt;VAR WEIGHT;&lt;BR /&gt;RANKS WTQUINT2;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC FREQ DATA=mod4_2;&lt;BR /&gt;TABLES WTQUINT2;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;I still get a blank table</description>
      <pubDate>Mon, 31 Jan 2022 22:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793643#M38894</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-01-31T22:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793644#M38895</link>
      <description>Look at the OUT= data set NOT the input data set (mod4_2)&lt;BR /&gt;proc freq data=four;</description>
      <pubDate>Mon, 31 Jan 2022 22:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793644#M38895</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-01-31T22:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793645#M38896</link>
      <description>Sorry, as you can tell I'm very new to SAS.&lt;BR /&gt;&lt;BR /&gt;So Proc Freq data=four; where do I place that in my code?</description>
      <pubDate>Mon, 31 Jan 2022 22:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793645#M38896</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-01-31T22:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793646#M38897</link>
      <description>anywhere after the input data set (mod4_2) is created.</description>
      <pubDate>Mon, 31 Jan 2022 22:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793646#M38897</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2022-01-31T22:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793647#M38898</link>
      <description>Wish I could post an image of my blank table. I believe it is how I did my &amp;gt; and &amp;lt; steps prior. But your code is working.</description>
      <pubDate>Mon, 31 Jan 2022 22:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793647#M38898</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-01-31T22:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793648#M38899</link>
      <description>&lt;P&gt;I think they are asking you to use PROC RANK on your original dataset.&lt;/P&gt;
&lt;P&gt;So no need for you to manually try to create the 5 categories, let PROC RANK do that for you.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 23:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793648#M38899</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-31T23:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 level categorical variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793652#M38900</link>
      <description>No I figured it out. It was because I put a . infront of .20 instead of just 20 bc sas is already reading it as .20</description>
      <pubDate>Tue, 01 Feb 2022 00:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Creating-a-5-level-categorical-variable/m-p/793652#M38900</guid>
      <dc:creator>saza</dc:creator>
      <dc:date>2022-02-01T00:14:28Z</dc:date>
    </item>
  </channel>
</rss>

