<?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: Advanced Percentile Questions in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86358#M24663</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For now just the prices. My main problem is how to find the percentile for a variable based on observations in another dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Set 1&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;15&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Data Set 1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Data Set 2&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;25&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I like my program to return for data set 1 is this (percentage of observations in dataset 2 that are less than or equal to each observation in dataset 1)&lt;/P&gt;&lt;P&gt;10-&amp;gt;0%&lt;/P&gt;&lt;P&gt;15-&amp;gt;66.6%&lt;/P&gt;&lt;P&gt;20-&amp;gt;66.6%&lt;/P&gt;&lt;P&gt;25-&amp;gt;100%&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jun 2012 19:48:46 GMT</pubDate>
    <dc:creator>medanesh</dc:creator>
    <dc:date>2012-06-18T19:48:46Z</dc:date>
    <item>
      <title>Advanced Percentile Questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86356#M24661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been stuck with this question for quite a while now. I'm new to SAS and the question I'm asking might be quite easy to answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say I have two datasets, for examples &lt;STRONG&gt;American Used Cars&lt;/STRONG&gt; and &lt;STRONG&gt;Canadian Used Cars&lt;/STRONG&gt;. Each dataset contains a variable called price. What I would like to do is to find the percentile for each Price in the Canadian dataset based on all the prices in the American Dataset. Basically I would like to know the price of each used car in Canada was greater than what percent of the prices in the American market.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is very much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Erfan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 18:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86356#M24661</guid>
      <dc:creator>medanesh</dc:creator>
      <dc:date>2012-06-18T18:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced Percentile Questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86357#M24662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to do this by make, model, model year and such?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 19:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86357#M24662</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-06-18T19:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced Percentile Questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86358#M24663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For now just the prices. My main problem is how to find the percentile for a variable based on observations in another dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Set 1&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;15&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Data Set 1&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Data Set 2&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;20&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;25&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I like my program to return for data set 1 is this (percentage of observations in dataset 2 that are less than or equal to each observation in dataset 1)&lt;/P&gt;&lt;P&gt;10-&amp;gt;0%&lt;/P&gt;&lt;P&gt;15-&amp;gt;66.6%&lt;/P&gt;&lt;P&gt;20-&amp;gt;66.6%&lt;/P&gt;&lt;P&gt;25-&amp;gt;100%&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 19:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86358#M24663</guid>
      <dc:creator>medanesh</dc:creator>
      <dc:date>2012-06-18T19:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced Percentile Questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86359#M24664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider this method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;/* Simulate data for American and Canadian Car Prices */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;data auc cuc;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;call streaminit(876878);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;do i = 1 to 10;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price = 10**(4+0.3*rand("NORMAL"));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output auc; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price = 10**(3.5+0.3*rand("NORMAL"));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output auc;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price = 10**(4+0.4*rand("NORMAL"));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output cuc;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;run; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;/* Generate the percentiles */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;proc rank data=auc out=aucr percent; var price; ranks percent; run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;proc rank data=cuc out=cucr percent; var price; ranks percent; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;/* Merge the datasets */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;data ucr;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;set aucr cucr INDSNAME=_s;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;source = _s;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;proc sort data=ucr; by price source; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;/* Scan the prices, remember the american percentiles as we go */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;data want(keep=price percent USpercent);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;set ucr;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;retain USpercent;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;if source = "WORK.AUCR" &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then USpercent = percent;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;proc print ; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt;"&gt;PG&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 20:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86359#M24664</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-06-18T20:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced Percentile Questions</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86360#M24665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot PG. That was really helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2012 21:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Advanced-Percentile-Questions/m-p/86360#M24665</guid>
      <dc:creator>medanesh</dc:creator>
      <dc:date>2012-06-18T21:39:29Z</dc:date>
    </item>
  </channel>
</rss>

