<?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 Trichotomization in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562273#M74928</link>
    <description>&lt;P&gt;I have GHQ12 which has 13 different cohorts. I need to make it a variable with only 3 categories.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I used the following code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.sampsys1;
set work.sampSys;
If GHQ12 = 0 then GHQ3 = 1;
If GHQ12 &amp;gt; 0 and GHQ12 &amp;lt; 3 THEN GHQ3 = 2;
else GHQ3 = 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;I have the following error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="error.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29848iC0F6F30F47021E1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the frequency table for GHQ12:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="111.PNG" style="width: 167px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29849i4C60E4AFE2ECAF2C/image-size/large?v=v2&amp;amp;px=999" role="button" title="111.PNG" alt="111.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;May you please help me?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 18:50:04 GMT</pubDate>
    <dc:creator>Sahar775</dc:creator>
    <dc:date>2019-05-29T18:50:04Z</dc:date>
    <item>
      <title>Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562273#M74928</link>
      <description>&lt;P&gt;I have GHQ12 which has 13 different cohorts. I need to make it a variable with only 3 categories.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I used the following code:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.sampsys1;
set work.sampSys;
If GHQ12 = 0 then GHQ3 = 1;
If GHQ12 &amp;gt; 0 and GHQ12 &amp;lt; 3 THEN GHQ3 = 2;
else GHQ3 = 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;I have the following error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="error.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29848iC0F6F30F47021E1B/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the frequency table for GHQ12:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="111.PNG" style="width: 167px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29849i4C60E4AFE2ECAF2C/image-size/large?v=v2&amp;amp;px=999" role="button" title="111.PNG" alt="111.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;May you please help me?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562273#M74928</guid>
      <dc:creator>Sahar775</dc:creator>
      <dc:date>2019-05-29T18:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562277#M74929</link>
      <description>&lt;P&gt;I would rewrite the program as follows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.sampsys1;
set work.sampSys;
If GHQ12 = 0 then GHQ3 = 1;
else If 0 &amp;lt; GHQ12 &amp;lt; 3 then GHQ3 = 2;
else GHQ3 = 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and that should be programatically correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unless the error is to do with code you haven't provided it shouldn't occur now.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 13:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562277#M74929</guid>
      <dc:creator>33pedro</dc:creator>
      <dc:date>2019-05-29T13:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562278#M74930</link>
      <description>there also seems to be a .0 in the frequency table which may need addressing</description>
      <pubDate>Wed, 29 May 2019 13:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562278#M74930</guid>
      <dc:creator>33pedro</dc:creator>
      <dc:date>2019-05-29T13:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562282#M74931</link>
      <description>&lt;P&gt;Thank you so much, Pedro. Still, I have the same error. I checked GHQ12 and this is some units of this variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="error2.PNG" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29851i14145DD938B347A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="error2.PNG" alt="error2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried your code on the different data set, still, I have the exact same error.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 14:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562282#M74931</guid>
      <dc:creator>Sahar775</dc:creator>
      <dc:date>2019-05-29T14:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562292#M74933</link>
      <description>&lt;P&gt;I tried to add&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275142"&gt;@33pedro&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;there also seems to be a .0 in the frequency table which may need addressing&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;Tried to address it. Not really working. Maybe because I do not know how to address .o in my dataset!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class="language-sas"&gt;data work.impo;
set work.import;
If GHQ12 = .0 then GHQ3 = 1;
else If .0 &amp;lt; GHQ12 &amp;lt; 3 then GHQ3 = 2;
else GHQ3 = 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562292#M74933</guid>
      <dc:creator>Sahar775</dc:creator>
      <dc:date>2019-05-29T18:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562294#M74934</link>
      <description>&lt;P&gt;I assume from the . values that this is a numeric variable? The .0 values look a bit unusual which is why I am asking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.sampsys1;
set work.sampSys;
if GHQ12 = .0 then GHQ12 = 0;
If GHQ12 = 0 then GHQ3 = 1;
else If 0 &amp;lt; GHQ12 &amp;lt; 3 then GHQ3 = 2;
else GHQ3 = 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That should at least tell us if the .0 is causing the problem&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 14:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562294#M74934</guid>
      <dc:creator>33pedro</dc:creator>
      <dc:date>2019-05-29T14:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trichotomization</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562312#M74935</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275996"&gt;@Sahar775&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely, the error messages are caused by invalid formats (e.g. &lt;EM&gt;w.d&lt;/EM&gt; formats such as 1.2 or 2.2) which are permanently assigned to GHQ12 &lt;EM&gt;and other&lt;/EM&gt; variables in dataset WORK.SAMPSYS. (PROC SQL might have assigned these formats.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see which variables are affected, run a PROC CONTENTS step like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=work.sampsys;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and look at column "Format."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If &lt;EM&gt;all&lt;/EM&gt; formats there are invalid (such as 2.2) or unnecessary, you can remove all formats with PROC DATASETS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
modify sampsys;
format _all_;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise, you can specify individual valid formats and drop others as well by replacing &lt;FONT face="courier new,courier"&gt;format _all_;&lt;/FONT&gt; with a valid format specification in the above step. (Get back to us if you need help with this.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have changed/removed the assigned formats, check if the following step creates error messages:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set work.sampsys(obs=0);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the log is clean, you're ready to run your DATA step to create WORK.SAMPSYS1.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 15:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trichotomization/m-p/562312#M74935</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-05-29T15:07:17Z</dc:date>
    </item>
  </channel>
</rss>

