<?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 an Income Series into Deci in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42652#M11101</link>
    <description>Oh, I just wondered because&lt;BR /&gt;
[pre]&lt;BR /&gt;
else if PPI &lt;BR /&gt;
[/pre]&lt;BR /&gt;
              &lt;BR /&gt;
(which is where your post ends ... is not a complete, valid SAS statement).&lt;BR /&gt;
 &lt;BR /&gt;
It just seemed odd.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
    <pubDate>Wed, 30 Jun 2010 16:58:10 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2010-06-30T16:58:10Z</dc:date>
    <item>
      <title>Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42648#M11097</link>
      <description>Hello Colleagues,&lt;BR /&gt;
&lt;BR /&gt;
I am trying to split the values of income variable “PPI” below into 10 parts (deciles). PPI has over 10,000 records.&lt;BR /&gt;
&lt;BR /&gt;
I attempted the program indicated below but all values for the newly created ‘PPI_decile’ variable turn out to be “10” whereas it should have been 1, 2,3,4, 5, 6, 7,8, 9 and 10.&lt;BR /&gt;
&lt;BR /&gt;
I wonder if anyone of you could help me to revise this program or suggest a more efficient approach.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Data data_families1;&lt;BR /&gt;
Input ID PPI;&lt;BR /&gt;
Cards;&lt;BR /&gt;
1  750&lt;BR /&gt;
2  800&lt;BR /&gt;
3  850&lt;BR /&gt;
4  950&lt;BR /&gt;
5  1250&lt;BR /&gt;
6  1500&lt;BR /&gt;
7  .&lt;BR /&gt;
8  1600&lt;BR /&gt;
9  1700&lt;BR /&gt;
10 1850&lt;BR /&gt;
11 2500&lt;BR /&gt;
12 750&lt;BR /&gt;
13 2100&lt;BR /&gt;
14 2500&lt;BR /&gt;
15 3750&lt;BR /&gt;
16 .&lt;BR /&gt;
17 750&lt;BR /&gt;
;&lt;BR /&gt;
Run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/*DECILE CALCULATIONS*/&lt;BR /&gt;
proc univariate data=data_families1;&lt;BR /&gt;
var PPI;&lt;BR /&gt;
output out=decile pctlpts=10 20 30 40 50 60 70 80 90 pctlpre=pct;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/*Write the cut points to macro variable*/&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set data_families1;&lt;BR /&gt;
call symput ('q1', pct10);&lt;BR /&gt;
call symput ('q2', pct20);&lt;BR /&gt;
call symput ('q3', pct30);&lt;BR /&gt;
call symput ('q4', pct40);&lt;BR /&gt;
call symput ('q5', pct50);&lt;BR /&gt;
call symput ('q6', pct60);&lt;BR /&gt;
call symput ('q7', pct70);&lt;BR /&gt;
call symput ('q8', pct80);&lt;BR /&gt;
call symput ('q9', pct90);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/*Creating a new variable containing the deciles*/&lt;BR /&gt;
data data_families2;&lt;BR /&gt;
set data_families1;&lt;BR /&gt;
if PPI=. then PPI_decile=.;&lt;BR /&gt;
else if PPI &amp;lt;=&amp;amp;q1 then PPI_decile=1;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q2 then PPI_decile=2;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q3 then PPI_decile=3;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q4 then PPI_decile=4;&lt;BR /&gt;
&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q5 then PPI_decile=5;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q6 then PPI_decile=6;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q7 then PPI_decile=7;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q8 then PPI_decile=8;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q9 then PPI_decile=9;&lt;BR /&gt;
else PPI_decile=10;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
&lt;BR /&gt;
Mirisage</description>
      <pubDate>Wed, 30 Jun 2010 15:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42648#M11097</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-06-30T15:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42649#M11098</link>
      <description>Hi:&lt;BR /&gt;
  Did your code example get cut off??? Remember that if your code contains &amp;lt; or &amp;gt; symbols, you need to "protect" them, as described in this previous forum posting:&lt;BR /&gt;
 &lt;A href="http://support.sas.com/forums/thread.jspa?messageID=27609毙" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=27609毙&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 30 Jun 2010 15:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42649#M11098</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-06-30T15:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42650#M11099</link>
      <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
No, it did not get cut off.&lt;BR /&gt;
&lt;BR /&gt;
So, the question is how to split the PPI variable below into 10 parts (deciles) using SAS.&lt;BR /&gt;
&lt;BR /&gt;
Data data_families1;&lt;BR /&gt;
Input ID PPI;&lt;BR /&gt;
Cards;&lt;BR /&gt;
1  750&lt;BR /&gt;
2  800&lt;BR /&gt;
3  850&lt;BR /&gt;
4  950&lt;BR /&gt;
5  1250&lt;BR /&gt;
6  1500&lt;BR /&gt;
7  .&lt;BR /&gt;
8  1600&lt;BR /&gt;
9  1700&lt;BR /&gt;
10 1850&lt;BR /&gt;
11 2500&lt;BR /&gt;
12 750&lt;BR /&gt;
13 2100&lt;BR /&gt;
14 2500&lt;BR /&gt;
15 3750&lt;BR /&gt;
16 .&lt;BR /&gt;
17 750&lt;BR /&gt;
;&lt;BR /&gt;
Run;</description>
      <pubDate>Wed, 30 Jun 2010 16:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42650#M11099</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-06-30T16:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42651#M11100</link>
      <description>I think you want PROC RANK with the GROUPS option.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data data_families1;&lt;BR /&gt;
   Input ID PPI @@;&lt;BR /&gt;
   Cards;&lt;BR /&gt;
1 750 2 800 3 850 4 950 5 1250 6 1500 7 .&lt;BR /&gt;
8 1600 9 1700  10 1850 11 2500 12 750 13 2100&lt;BR /&gt;
14 2500 15 3750 16 . 17 750&lt;BR /&gt;
;&lt;BR /&gt;
   Run; &lt;BR /&gt;
proc rank group=10 out=deciles;&lt;BR /&gt;
   var ppi;&lt;BR /&gt;
   ranks decile;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 30 Jun 2010 16:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42651#M11100</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-06-30T16:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42652#M11101</link>
      <description>Oh, I just wondered because&lt;BR /&gt;
[pre]&lt;BR /&gt;
else if PPI &lt;BR /&gt;
[/pre]&lt;BR /&gt;
              &lt;BR /&gt;
(which is where your post ends ... is not a complete, valid SAS statement).&lt;BR /&gt;
 &lt;BR /&gt;
It just seemed odd.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 30 Jun 2010 16:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42652#M11101</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-06-30T16:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42653#M11102</link>
      <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
This is the complete program I attempted to split the above data set into deciles.&lt;BR /&gt;
&lt;BR /&gt;
/*DECILE CALCULATIONS*/&lt;BR /&gt;
proc univariate data=data_families1;&lt;BR /&gt;
var PPI;&lt;BR /&gt;
output out=percentile pctlpts=10 20 30 40 50 60 70 80 90 pctlpre=pct;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/*Write the cutpoints to macro variables*/&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set data_families1;&lt;BR /&gt;
call symput ('q1', pct10);&lt;BR /&gt;
call symput ('q2', pct20);&lt;BR /&gt;
call symput ('q3', pct30);&lt;BR /&gt;
call symput ('q4', pct40);&lt;BR /&gt;
call symput ('q5', pct50);&lt;BR /&gt;
call symput ('q6', pct60);&lt;BR /&gt;
call symput ('q7', pct70);&lt;BR /&gt;
call symput ('q8', pct80);&lt;BR /&gt;
call symput ('q9', pct90);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/*Create a new variable containing the DECILES*/&lt;BR /&gt;
data data_families2;&lt;BR /&gt;
set data_families1;&lt;BR /&gt;
if PPI=. then PPI_quint=.;&lt;BR /&gt;
else if PPI &amp;lt;=&amp;amp;q1 then PPI_quint=1;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q2 then PPI_quint=2;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q3 then PPI_quint=3;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q4 then PPI_quint=4;&lt;BR /&gt;
&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q5 then PPI_quint=5;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q6 then PPI_quint=6;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q7 then PPI_quint=7;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q8 then PPI_quint=8;&lt;BR /&gt;
else if PPI&amp;lt;=&amp;amp;q9 then PPI_quint=9;&lt;BR /&gt;
&lt;BR /&gt;
else PPI_quint=10;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
/*Test to make sure it worked*/&lt;BR /&gt;
proc means data=data_families2 missing;&lt;BR /&gt;
class PPI_quint;&lt;BR /&gt;
var PPI;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 30 Jun 2010 19:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42653#M11102</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-06-30T19:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42654#M11103</link>
      <description>Hi Cynthia, &lt;BR /&gt;
&lt;BR /&gt;
Sorry, although I pasted the complete program again in the window above, it is truncated automatically. So, only a part is shown.</description>
      <pubDate>Wed, 30 Jun 2010 19:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42654#M11103</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-06-30T19:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42655#M11104</link>
      <description>Hi data_null_,&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for these codes. &lt;BR /&gt;
&lt;BR /&gt;
They worked correctly.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
Thank you as well for your support.&lt;BR /&gt;
&lt;BR /&gt;
Mirisage</description>
      <pubDate>Wed, 30 Jun 2010 19:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42655#M11104</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-06-30T19:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42656#M11105</link>
      <description>&amp;gt; Hello Colleagues,&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I am trying to split the values of income variable “PPI” below into 10 parts (deciles). PPI has over 10,000 records.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I attempted the program indicated below but all values for the newly created ‘PPI_decile’ variable turn out to be “10” whereas it should have been 1, 2,3,4, 5, 6, 7,8, 9 and 10.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I wonder if anyone of you could help me to revise this program or suggest a more efficient approach.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Data data_families1;&lt;BR /&gt;
&amp;gt; Input ID PPI;&lt;BR /&gt;
&amp;gt; Cards;&lt;BR /&gt;
&amp;gt; 1  750&lt;BR /&gt;
&amp;gt; 2  800&lt;BR /&gt;
&amp;gt; 3  850&lt;BR /&gt;
&amp;gt; 4  950&lt;BR /&gt;
&amp;gt; 5  1250&lt;BR /&gt;
&amp;gt; 6  1500&lt;BR /&gt;
&amp;gt; 7  .&lt;BR /&gt;
&amp;gt; 8  1600&lt;BR /&gt;
&amp;gt; 9  1700&lt;BR /&gt;
&amp;gt; 10 1850&lt;BR /&gt;
&amp;gt; 11 2500&lt;BR /&gt;
&amp;gt; 12 750&lt;BR /&gt;
&amp;gt; 13 2100&lt;BR /&gt;
&amp;gt; 14 2500&lt;BR /&gt;
&amp;gt; 15 3750&lt;BR /&gt;
&amp;gt; 16 .&lt;BR /&gt;
&amp;gt; 17 750&lt;BR /&gt;
&amp;gt; ;&lt;BR /&gt;
&amp;gt; Run;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; /*DECILE CALCULATIONS*/&lt;BR /&gt;
&amp;gt; proc univariate data=data_families1;&lt;BR /&gt;
&amp;gt; var PPI;&lt;BR /&gt;
&amp;gt; output out=decile pctlpts=10 20 30 40 50 60 70 80 90&lt;BR /&gt;
&amp;gt; pctlpre=pct;&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; /*Write the cut points to macro variable*/&lt;BR /&gt;
&amp;gt; data _null_;&lt;BR /&gt;
&amp;gt; set data_families1;&lt;BR /&gt;
&amp;gt; call symput ('q1', pct10);&lt;BR /&gt;
&amp;gt; call symput ('q2', pct20);&lt;BR /&gt;
&amp;gt; call symput ('q3', pct30);&lt;BR /&gt;
&amp;gt; call symput ('q4', pct40);&lt;BR /&gt;
&amp;gt; call symput ('q5', pct50);&lt;BR /&gt;
&amp;gt; call symput ('q6', pct60);&lt;BR /&gt;
&amp;gt; call symput ('q7', pct70);&lt;BR /&gt;
&amp;gt; call symput ('q8', pct80);&lt;BR /&gt;
&amp;gt; call symput ('q9', pct90);&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; /*Creating a new variable containing the deciles*/&lt;BR /&gt;
&amp;gt; data data_families2;&lt;BR /&gt;
&amp;gt; set data_families1;&lt;BR /&gt;
&amp;gt; if PPI=. then PPI_decile=.;&lt;BR /&gt;
&amp;gt; else if PPI LE&amp;amp;q1 then PPI_decile=1;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q2 then PPI_decile=2;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q3 then PPI_decile=3;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q4 then PPI_decile=4;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q5 then PPI_decile=5;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q6 then PPI_decile=6;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q7 then PPI_decile=7;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q8 then PPI_decile=8;&lt;BR /&gt;
&amp;gt; else if PPI LE &amp;amp;q9 then PPI_decile=9;&lt;BR /&gt;
&amp;gt; else PPI_decile=10;&lt;BR /&gt;
&amp;gt; run;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thank you&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Mirisage&lt;BR /&gt;
&lt;BR /&gt;
Mirisage&lt;BR /&gt;
1&lt;BR /&gt;
  your program was entirely there, as quoting your message reveals it. It was just not displayed from the first ≤ . So in this response I've replaced those with ≤ and a ;&lt;BR /&gt;
 &lt;BR /&gt;
2&lt;BR /&gt;
   your problem was not because you used symput() instead of symputX() (although your choice does not help diagnose the problem)&lt;BR /&gt;
 &lt;BR /&gt;
3&lt;BR /&gt;
 your solution placed all into PPI_decile =10 because you loaded the macro variables from the input to proc univariate data=data_families1 instead of from the output dataset  out=decile.&lt;BR /&gt;
 &lt;BR /&gt;
with that change, your solution works just fine.&lt;BR /&gt;
Now [inappropriate question], is it better than the proc rank approach ?&lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
  &lt;BR /&gt;
 &lt;BR /&gt;
answer ="special missing value" [question not applicable]</description>
      <pubDate>Fri, 02 Jul 2010 13:13:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42656#M11105</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-07-02T13:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Categorizing an Income Series into Deci</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42657#M11106</link>
      <description>Hi Peter,&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for this.&lt;BR /&gt;
&lt;BR /&gt;
Mirisage</description>
      <pubDate>Fri, 02 Jul 2010 16:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Categorizing-an-Income-Series-into-Deci/m-p/42657#M11106</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2010-07-02T16:28:29Z</dc:date>
    </item>
  </channel>
</rss>

