<?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 Split a continuous variable with proc tabulate in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546066#M8150</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a variable x1 that range from 0 to 1 and a variable x2 that range from -10 to +10. I want to create a crosstable showing the average of x2 for different ranges of x, such as&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" width="128" cellspacing="0" cellpadding="0" border="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 48pt;" width="64" height="20"&gt;x1&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;&amp;nbsp;average of x2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;0-0.1&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;0.1-0.2&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;…&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;0.9-1&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I could easily split the variable x1 in a data statement, but I wonder if it this possible to split in within the proc tabulate statement.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2019 10:41:02 GMT</pubDate>
    <dc:creator>Demographer</dc:creator>
    <dc:date>2019-03-26T10:41:02Z</dc:date>
    <item>
      <title>Split a continuous variable with proc tabulate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546066#M8150</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a variable x1 that range from 0 to 1 and a variable x2 that range from -10 to +10. I want to create a crosstable showing the average of x2 for different ranges of x, such as&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" width="128" cellspacing="0" cellpadding="0" border="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 48pt;" width="64" height="20"&gt;x1&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;&amp;nbsp;average of x2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;0-0.1&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;0.1-0.2&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;…&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" height="20"&gt;0.9-1&lt;/TD&gt;
&lt;TD&gt;#&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I could easily split the variable x1 in a data statement, but I wonder if it this possible to split in within the proc tabulate statement.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 10:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546066#M8150</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2019-03-26T10:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Split a continuous variable with proc tabulate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546111#M8165</link>
      <description>&lt;P&gt;You can, but you have to define a format first to identify the splits.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
   value tenths 
   0-0.1 = '0.0-0.1'
   0.1-0.2 = '0.1-0.2'
   0.2-0.3 = '0.2-0.3'
   0.3-0.4 = '0.3-0.4'
   0.4-0.5 = '0.4-0.5'
   0.5-0.6 = '0.5-0.6'
   0.6-0.7 = '0.6-0.7'
   0.7-0.8 = '0.7-0.8'
   0.8-0.9 = '0.8-0.9'
   0.9-1 = '0.9-1.0'
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Having done that, you can apply the format within PROC TABULATE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=have;
   class x1;
   var x2;
   tables x1, x2*mean;
   format x1 tenths.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Mar 2019 12:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546111#M8165</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-26T12:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Split a continuous variable with proc tabulate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546174#M8175</link>
      <description>&lt;P&gt;Being a mathematician, I cringe when I don't know which interval an end-point value occurs in, or even if it&amp;nbsp;appears in&amp;nbsp;any.&amp;nbsp;So if X has a value of exactly 0.1 should it be considered in the 0.0-0.1 range or the 0.1 -0.2 range?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;'s format will place the value of 0.1 in the 0.1 -0.2 range.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 14:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546174#M8175</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-26T14:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Split a continuous variable with proc tabulate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546176#M8177</link>
      <description>My example was just theoritical, so it doesn't matter.</description>
      <pubDate>Tue, 26 Mar 2019 14:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546176#M8177</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2019-03-26T14:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Split a continuous variable with proc tabulate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546182#M8179</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/33143"&gt;@Demographer&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;My example was just theoritical, so it doesn't matter.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will politely beg to differ. Assignment to categories for analysis may be critical, especially if you have lots of values exactly on the endpoints of intervals. Especially in a group working&amp;nbsp;environment. If you do an analysis with 0.1 in the 0.1 -0.2 group and another team assigns it to the 0.0-0.1 you will have fun reconciling things like N's not matching in different places, or model results if the categorical assignment is used in a class type variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also have to meet an external client or even government agency's definition and failure to do so could put you or your organization in a number of binds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2019 14:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546182#M8179</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-26T14:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Split a continuous variable with proc tabulate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546185#M8180</link>
      <description>I mean, this was not a real example, so I don't mind if it's 0-0.1[ or 0-0.01]. I just wanted to know if there is a code to do it automatically in proc tabulate. Of course, when I'll code it, I will be cautious that categories fit.</description>
      <pubDate>Tue, 26 Mar 2019 15:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Split-a-continuous-variable-with-proc-tabulate/m-p/546185#M8180</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2019-03-26T15:00:46Z</dc:date>
    </item>
  </channel>
</rss>

