<?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: grouping in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268822#M490</link>
    <description>&lt;P&gt;Thank you sooo much,&lt;/P&gt;&lt;P&gt;now I need to analyze the means of different variables of these groups. This following procedure says that this "proc means; by lowIMC mediumIMC highIMC error" are not valid groups.... what should I do....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data lowIMC mediumIMC highIMC error;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set BIOMRKR;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (IMC &amp;lt;= 25) output lowIMC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (IMC &amp;lt; 30) output mediumIMC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (IMC &amp;gt;= 30) output highIMC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise output error;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means; by lowIMC mediumIMC highIMC error; var fruit legume f_l dietacar dietbcar bcryp lycopene lutzea;run;&lt;/P&gt;&lt;P&gt;proc corr;var fruit dietacar; run;&lt;/P&gt;&lt;P&gt;proc corr; var fruit dietbcar;run;&lt;/P&gt;</description>
    <pubDate>Fri, 06 May 2016 15:24:59 GMT</pubDate>
    <dc:creator>Tatiana1</dc:creator>
    <dc:date>2016-05-06T15:24:59Z</dc:date>
    <item>
      <title>grouping</title>
      <link>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268806#M488</link>
      <description>&lt;P&gt;I am with SAS studio.&lt;/P&gt;&lt;P&gt;I have a sas7data file with a large table with different subjects as the independant variable and their anthropometric data (weight, age, BMI, etc) as dependant variables.&lt;/P&gt;&lt;P&gt;I am trying to sort this data by BMI (for body mass index) in order to creat groups of people having a BMI &amp;lt; or = to 25, &amp;gt;25 to &amp;lt;30 and &amp;gt; or = 30. How do I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 14:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268806#M488</guid>
      <dc:creator>Tatiana1</dc:creator>
      <dc:date>2016-05-06T14:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: grouping</title>
      <link>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268815#M489</link>
      <description>Great question! Do you want separate data sets for each group?&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lowBMI mediumBMI highBMI error;
    set originalDataSet;
    select; 
        when (BMI &amp;lt;= 25) output lowBMI; 
        when (BMI &amp;lt; 30) output mediumBMI; 
        when (BMI &amp;gt;= 30) output highBMI; 
        otherwise output error;
    end; 
run;&lt;/CODE&gt;&lt;/PRE&gt;If you want to keep them in the same data set but add a variable with category, you can instead of "output dataSet" say BMIcategory = "low", for example.&lt;BR /&gt;&lt;BR /&gt;Another solution is a user-defined format. There's a good &lt;A href="http://libguides.library.kent.edu/SAS/UserDefinedFormats" target="_blank"&gt;tutorial here&lt;/A&gt; if you'd prefer that.</description>
      <pubDate>Fri, 06 May 2016 15:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268815#M489</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-05-06T15:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: grouping</title>
      <link>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268822#M490</link>
      <description>&lt;P&gt;Thank you sooo much,&lt;/P&gt;&lt;P&gt;now I need to analyze the means of different variables of these groups. This following procedure says that this "proc means; by lowIMC mediumIMC highIMC error" are not valid groups.... what should I do....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data lowIMC mediumIMC highIMC error;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set BIOMRKR;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (IMC &amp;lt;= 25) output lowIMC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (IMC &amp;lt; 30) output mediumIMC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (IMC &amp;gt;= 30) output highIMC;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise output error;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means; by lowIMC mediumIMC highIMC error; var fruit legume f_l dietacar dietbcar bcryp lycopene lutzea;run;&lt;/P&gt;&lt;P&gt;proc corr;var fruit dietacar; run;&lt;/P&gt;&lt;P&gt;proc corr; var fruit dietbcar;run;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 15:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268822#M490</guid>
      <dc:creator>Tatiana1</dc:creator>
      <dc:date>2016-05-06T15:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: grouping</title>
      <link>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268823#M491</link>
      <description>&lt;P&gt;Well if you do it like that, lowIMC, mediumIMC, highIMC, and error are different data sets. So use a separate PROC MEANS for each.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 15:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268823#M491</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-05-06T15:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: grouping</title>
      <link>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268882#M495</link>
      <description>&lt;P&gt;It may be much easier in the long run to use Paulkaefer's idea of adding a variable to represent the categories.&lt;/P&gt;
&lt;P&gt;Please see:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set originalDataSet;
    select; 
        when (BMI &amp;lt;= 25) BmiCat='Low'; 
        when (BMI &amp;lt; 30) BmiCat='Medium'; 
        when (BMI &amp;gt;= 30) BmiCat='Obese'; 
        otherwise ;
    end; 
run;

proc means data=want;
   class BmiCat;
   var fruit legume f_l dietacar dietbcar bcryp lycopene lutzea;
run;

proc sort data=want;
   by BmiCat;
run;

proc corr data=want;
   by BmiCat;
   var Fruit dietacar;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 May 2016 18:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/grouping/m-p/268882#M495</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-06T18:56:40Z</dc:date>
    </item>
  </channel>
</rss>

