<?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: How to use the rand function to generate values for a continuous variable with restrictions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677569#M204399</link>
    <description>Thank you. That worked.</description>
    <pubDate>Tue, 18 Aug 2020 17:43:06 GMT</pubDate>
    <dc:creator>MichelleR0</dc:creator>
    <dc:date>2020-08-18T17:43:06Z</dc:date>
    <item>
      <title>How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675067#M203343</link>
      <description>&lt;P&gt;I found the following syntax to randomly generate age for 200 observations with specified values for mean and S.D.&amp;nbsp; &amp;nbsp; I would also like to restrict the age values to be between 18 and 100 and would like to specify the median value.&amp;nbsp; Could anyone suggest how I can add syntax or modify this code to do so?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Let points = 1;&amp;nbsp;&lt;BR /&gt;%Let mu = 71.1;&lt;BR /&gt;%Let sigma = 11.8;&lt;BR /&gt;%Let norm = rand('normal',&amp;amp;mu,&amp;amp;sigma);&lt;BR /&gt;data two; set test;&lt;BR /&gt;call streaminit (123);&lt;BR /&gt;do x=1 to &amp;amp;points;&lt;BR /&gt;age=&amp;amp;norm;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 16:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675067#M203343</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-06T16:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675074#M203345</link>
      <description>&lt;P&gt;It sounds like you do not want a Normal distribution, so what distribution should be used?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 17:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675074#M203345</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-06T17:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675087#M203346</link>
      <description>&lt;P&gt;For a normal distribution the median should be the mean. If you want a different value for median than the mean then you may not want a normal distribution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chopping off the upper and lower at different standard deviations from the mean will move the mean/median values of your "normal" distribution. Your proposed range cuts off more of the upper tail (at about 2.4 sigma) than the lower (about -4.5 sigma) with your stated mean and standard deviation for the rand 'normal' so would tend to make the resulting observed mean/median LOWER than the specified mu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Test the value of each generated age. If not in the range, then do the call to the rand function again. Look at the much maligned GOTO and LABEL in the data step for one way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 18:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675087#M203346</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-06T18:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675102#M203352</link>
      <description>&lt;P&gt;Thank you for your reply.&amp;nbsp; I believe I should clarify my goal.&amp;nbsp; I want to create a fake data set based on existing data.&amp;nbsp; So for example, if the existing data set has mean age and S.D. of 78 (11) then I want to create fake data with age that has the same mean and S.D. but also want the min and max age to be the same in the fake data as the real data set.&amp;nbsp; I want to duplicate this for other variables of interest from the original data set.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 18:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675102#M203352</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-06T18:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675119#M203358</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/340602"&gt;@MichelleR0&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for your reply.&amp;nbsp; I believe I should clarify my goal.&amp;nbsp; I want to create a fake data set based on existing data.&amp;nbsp; So for example, if the existing data set has mean age and S.D. of 78 (11) then I want to create fake data with age that has the same mean and S.D. but also want the min and max age to be the same in the fake data as the real data set.&amp;nbsp; I want to duplicate this for other variables of interest from the original data set.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And median? Or are you dropping that part? Or do you expect the result to match other summary statistics like Skewness, Kurtosis, or some other moment?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did your original data pass any test for coming from a normal distribution? If not, why did you start with normal data simulation?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675119#M203358</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-06T19:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675125#M203361</link>
      <description>&lt;P&gt;The simplest way is to sample from the empirical distribution that you are trying to match. You can use proc surveyselect with options method=urs and sampsize=200. Statistically, the new sample will have the same moments as the original sample.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 19:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675125#M203361</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-08-06T19:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675228#M203409</link>
      <description>&lt;P&gt;I don't have access to the original data set.&amp;nbsp; I need to create (simulate) a data set that will have the same moments (same results for distributions of characteristics, exposure, outcomes, etc) as the results reported from the original data set.&amp;nbsp; I hope that helps clarify?&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 11:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675228#M203409</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-07T11:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675234#M203410</link>
      <description>&lt;P&gt;Okay, then we return to the issue of what distribution do you want to generate, with given median min and max?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 12:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675234#M203410</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-07T12:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675236#M203411</link>
      <description>I’m not sure what the distribution for the data will be - I still need to&lt;BR /&gt;obtain that information. But if I am told that the age range was minimum&lt;BR /&gt;45 year olds and maximum 95 year olds, how can I restrict the min and max&lt;BR /&gt;age while also applying the specified mean and S.D.? Could the data s not&lt;BR /&gt;be normally distributed under these circumstances? Thank you.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Aug 2020 12:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675236#M203411</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-07T12:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675248#M203419</link>
      <description>&lt;P&gt;Once you put minimum and maximum values on a distribution, it can't be normal (but it may be approximately normal, depending on your definition of approximately).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are still waiting for you to tell us what distribution you want.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 14:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/675248#M203419</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-07T14:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676487#M203989</link>
      <description>&lt;P&gt;Thank you for the question.&amp;nbsp; I would like the variables in the simulated data set to match the summary statistics (and moments? not sure what the difference is?) for each variable from the original data set.&amp;nbsp; So, I would like the simulated data set to have the same mean, S.D., median, Skewness, etc&amp;nbsp; for the continuous variables as the reference data set.&amp;nbsp; I would also like to do the same for the categorical variables.&amp;nbsp; If the reference data set had 60% male and 40% female, I would like the simulated data set to have the same proportion for gender, and so for other categorical variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to data simulation so I am not sure what my first step should be when considering which procedure or method to use.&amp;nbsp; I am not familiar with Monte Carlo, but I know it is used often for data simulation.&amp;nbsp; Proc Surveyselect was recommended, but I'm not sure I understand the differences in these methods to know where to start.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 13:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676487#M203989</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-13T13:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676489#M203990</link>
      <description>&lt;P&gt;You still have not told us what distribution to use. We need to know this. Saying you want a specific mean, standard deviation, &lt;EM&gt;etc&lt;/EM&gt;. is not enough.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The best solution comes from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; who recommended sampling from the original data, using the distribution of your original data; but you stated you don't have the original data available. So we need to know more than you have told us so far.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 13:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676489#M203990</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-13T13:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676505#M203999</link>
      <description>I would like to use normal distribution for age. For weight, a nearly normal distribution, slight skewness to the right. Does that help? If I have a data set to use as a model, I am assuming I will apply different distributions as each variable would not necessarily have the same distribution. Is that correct?</description>
      <pubDate>Thu, 13 Aug 2020 14:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676505#M203999</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-13T14:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676521#M204007</link>
      <description>Thank you, PG. Per your suggestion, is there a way to keep the exposure fixed to 100 exposed and 100 unexposed? When I run proc surveyselect, it is assigning the appropriate moments to the independent variables, however, the proportion of exposed versus unexposed has changed so the moments are not the same when stratifying by exposure.</description>
      <pubDate>Thu, 13 Aug 2020 15:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676521#M204007</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-13T15:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676962#M204155</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt; I want to create fake data with age that has the same mean and S.D. but also want the &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt; min and max age to be the same in the fake data as the real data set.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Without getting too technical, let me briefly say that you don't actually want to generate new data that ave the same mean/SD/min/max as the DATA. Rather, you want to assume that the moments of the data are good estimates for the underlying data-generating process that produced the data in the first place. You then simulate from a DISTRIBUTION that has those moments. Due to sampling variability, the simulated data will not have exactly the same mean/SD as the data, and this is GOOD for various reasons.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That said, there are several ways to accomplish what you want:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. Resample from the data. This is called &lt;A href="https://blogs.sas.com/content/iml/2018/12/12/essential-guide-bootstrapping-sas.html" target="_self"&gt;the bootstrap method&lt;/A&gt; and is equivalent to sampling from the empirical distribution of the data. Unfortunately, you say that you do not have access to the original data, so this method is not available.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. If you have a table of percentiles for the original data, you can &lt;A href="https://blogs.sas.com/content/iml/2014/06/18/distribution-from-quantiles.html" target="_self"&gt;sample from the approximate empirical distribution&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. If you want to find a distribution that matches the moments of the data, you can perform &lt;A href="https://blogs.sas.com/content/iml/2017/11/27/method-of-moments-estimates-mle.html" target="_self"&gt;a momemt-matching computation.&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;However, this requires that you choose a distribution to simulate from.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4. You can use a flexible system of distributions to match the data. For example, you can use the &lt;A href="https://blogs.sas.com/content/iml/2020/01/20/johnson-sb-distribution.html" target="_self"&gt;Johnson SB&lt;/A&gt; and &lt;A href="https://blogs.sas.com/content/iml/2020/01/27/johnson-su-distribution.html" target="_self"&gt;Johnson SU systems&lt;/A&gt;. However, to fit these systems, you need the data or at least percentiles.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5. You can use&lt;A href="https://blogs.sas.com/content/iml/2012/10/24/pert-distribution.html" target="_self"&gt; the PERT distribution&lt;/A&gt;, which requires only estimates of the min, mode, and max. (The PERT distribution is a special beta distribution; modeling a general beta distribution is also possible.)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you don't have data or a table of percentiles, your options are limited. You might try the PERT distribution for a variable such as AGE, where you know the min, max, and mean/median.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Aug 2020 13:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/676962#M204155</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-08-15T13:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677272#M204276</link>
      <description>Thank you for your reply and for providing additional details in response to my questions. I was informed this morning that at a future date, I will have access to the original data. With that, could you please provide clarity on the following:&lt;BR /&gt;&lt;BR /&gt;1. Can you explain further what you meant by, 'You then simulate from a DISTRIBUTION that has those moments.'?&lt;BR /&gt;2. Given that I will have access to the original data, I understand that I could use the bootstrap method in Proc Surveyselect. You can confirm my understanding that I 1) simulate data (i.e. create a new data set with fake data) based on the moments from the original data set and then 2) run Proc Surveyselect with method=bootstrap on the simulated/fake data? Do I understand correctly that the original data is only used to inform simulation process?&lt;BR /&gt;3) If the simulated data has values that are beyond the original data (and inclusion criteria), is there a way to restrict this? For example, if the original data included patients &amp;gt;18 and &amp;lt;70 years of age with a normally distributed mean age of 55, and the simulated data included patents &amp;lt;18 or &amp;gt;70 years of age, is it appropriate to place these restrictions on the simulated data?&lt;BR /&gt;4) Also, my understanding is that I should have the same number of patients in the exposed and unexposed groups as the original data set. When I simulate the data and the use Proc Surveyselect to draw a sample of 200 (out of 20,000 in simulated data set), I no longer get the same number of patients in the exposed and unexposed groups. This is causing large variations in the variable distributions when stratifying by exposure group.</description>
      <pubDate>Mon, 17 Aug 2020 15:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677272#M204276</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-17T15:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677274#M204277</link>
      <description>&lt;P&gt;&lt;SPAN&gt;1. There are two kinds of simulation: parametric and nonparametric. In a parametric simulation, you fit a model to the data to obtain parameter estimates. You then assume that the estimates are the actual parameters and simulate from the model that has those parameters. For example, you might fit a normal distribution to data, find that the estimates are mu=1.23 and sigma=4.56. You would then simulate data from N(1.23, 4.56).&amp;nbsp; In a nonparametric simulation, you use the bootstrap method to sample directly from the empirical distribution.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. No. Your understanding is not correct. The input to PROC SURVEYSELECT is the original data. Please read about the Basic Bootstrap in &lt;A href="https://blogs.sas.com/content/iml/2018/12/12/essential-guide-bootstrapping-sas.html" target="_self"&gt;"The essential guide to bootstrapping in SAS."&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Regarding: "is it appropriate to place these restrictions on the simulated data?" You need to decide on the model FIRST, then simulate from that model. If you decide that the model is an unbounded distribution (for example, normal or exponential), then you might get values that are outside the range of the data. In many cases that is fine. In other situations (negative ages, extreme heights,...) that is not okay. If it is not okay, then you should choose a different model, such as a bounded distribution.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4) You can do stratified sampling with PROC SURVEYSELECT. It is not necessarily true that Whether you should get "the same number of patients in the exposed and unexposed groups as the original data set." It depends on the original data frame. For example, if the original design is "select 100 people at random," I might get 52 males and 48 females in the original data. But if I simulate that process, it is okay that each sample has a different proportion. On the other hand, if the original design is "select 50 males and 50 females," then you would want each simulated sample to have the same proportions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IMHO, your questions go beyond what can easily be handled on this forum. They are conceptual questions about how to construct a simulation, not SAS programming questions. You might consider consulting with a statistician, reading a book about simulation, or otherwise learning more about how simulation needs to reflect the data-generating mechanism for the data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 15:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677274#M204277</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-08-17T15:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677517#M204371</link>
      <description>The original design was to select 100 exposed and 100 unexposed. Using method=urs, I tried using the strata option for the variable that assigns exposure status. It returns a sample with an equal amount of subjects in each group, but less than n=100.</description>
      <pubDate>Tue, 18 Aug 2020 15:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677517#M204371</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-18T15:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677519#M204372</link>
      <description>&lt;P&gt;If you post your SAS code, we will be able to help you.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 15:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677519#M204372</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-08-18T15:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the rand function to generate values for a continuous variable with restrictions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677531#M204374</link>
      <description>Let me know if you need additional information. Thank you.&lt;BR /&gt;&lt;BR /&gt;proc surveyselect data = one method = urs seed = 3579 out = mi1 reps=1000 n=100;&lt;BR /&gt;strata trt;&lt;BR /&gt;run;</description>
      <pubDate>Tue, 18 Aug 2020 15:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-rand-function-to-generate-values-for-a-continuous/m-p/677531#M204374</guid>
      <dc:creator>MichelleR0</dc:creator>
      <dc:date>2020-08-18T15:49:57Z</dc:date>
    </item>
  </channel>
</rss>

