<?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: Rand() in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299497#M312168</link>
    <description>&lt;P&gt;You say it doesn't work. Please show us the SAS&amp;nbsp;code you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Sep 2016 09:54:01 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-09-20T09:54:01Z</dc:date>
    <item>
      <title>Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/298418#M312165</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I use Proc severity and i have parameter for GPD distribution,&lt;/P&gt;&lt;P&gt;I would like to use them to simulate an sampling of GPD like a "rand("Weib", 0.25,2.1)"&lt;/P&gt;&lt;P&gt;My parameters are for theta =126998.5 and for xi =0.31954.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 19:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/298418#M312165</guid>
      <dc:creator>Azeddine</dc:creator>
      <dc:date>2016-09-14T19:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/298645#M312166</link>
      <description>&lt;P&gt;Reference: p 113 of Wicklin (2013) &lt;A href="http://support.sas.com/publishing/authors/wicklin.html" target="_self"&gt;Simulating Data with SAS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The discussion begins with "you can use the inverse CDF algorithm to simulate random variates." It ends with this DATA step code:&lt;/P&gt;
&lt;P&gt;U = rand("Uniform");&lt;/P&gt;
&lt;P&gt;X = theta - sigma/alpha * (U**alpha-1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The three-parameter distribution&amp;nbsp;for the above uses &lt;A href="http://support.sas.com/documentation/cdl/en/procstat/68142/HTML/default/viewer.htm#procstat_univariate_details38.htm" target="_self"&gt;the parameterization documented in PROC UNIVARIATE&lt;/A&gt;: theta=threshold, sigma=scale, and alpha=shape.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 14:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/298645#M312166</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-15T14:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299481#M312167</link>
      <description>&lt;P&gt;Thank you for your answer, in my case it doesn't work,&lt;/P&gt;&lt;P&gt;So i try with a analytic inversion of function:&lt;/P&gt;&lt;P&gt;The initial Function of GPD is defined here in proc severity:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/63348/HTML/default/viewer.htm#etsug_severity_sect015.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/etsug/63348/HTML/default/viewer.htm#etsug_severity_sect015.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;with&amp;nbsp;x=(x'-Treshold)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this formula :&lt;/P&gt;&lt;P&gt;X'=&amp;amp;Treshold+(((1-rand('uniform'))**(-&amp;amp;&amp;amp;Gpd_xi))-1)*(&amp;amp;&amp;amp;Gpd_theta/&amp;amp;&amp;amp;Gpd_xi)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2016 07:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299481#M312167</guid>
      <dc:creator>Azeddine</dc:creator>
      <dc:date>2016-09-20T07:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299497#M312168</link>
      <description>&lt;P&gt;You say it doesn't work. Please show us the SAS&amp;nbsp;code you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2016 09:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299497#M312168</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-20T09:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299502#M312169</link>
      <description>&lt;P&gt;To be honnest it&amp;nbsp;gave&amp;nbsp;me result&amp;nbsp;but the result are different between resimulation with proc&amp;nbsp;univariate and&amp;nbsp;your&amp;nbsp;resimulation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2016 10:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299502#M312169</guid>
      <dc:creator>Azeddine</dc:creator>
      <dc:date>2016-09-20T10:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299503#M312170</link>
      <description>&lt;P&gt;If you shows that DATA step and PROC UNIVARIATE call, we can help diagnose the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2016 10:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299503#M312170</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-20T10:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rand()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299530#M312171</link>
      <description>&lt;P&gt;Here is simulation code and PROC UINIVARIATE code that shows agreement between the parameters and the parameter estimates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* simulation of generalized pareto distribution */
data GenPareto(keep= X);
alpha = 1/4;     /* shape */   
sigma = 10;      /* scale */
theta = 1.5;     /* threshold */
call streaminit(1);
/* support of x is theta + (0, sigma/alpha] = theta + (0,40] */
do i = 1 to 400;
   U = rand("Uniform");
   X = theta - sigma/alpha * (U**alpha - 1);
   output;
end;
run;

proc univariate data=GenPareto;
histogram x / pareto(threshold=1.5); /* parameters are alpha=0.25 sigma=10 */
ods select histogram;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Sep 2016 13:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand/m-p/299530#M312171</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-09-20T13:18:19Z</dc:date>
    </item>
  </channel>
</rss>

