<?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: Manipulating Randomly Generated sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597992#M172383</link>
    <description>&lt;P&gt;Thanks for your responses! here is the correct code I made with your advice:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Prob1A;
call streaminit (47);
k= 2000;
n= 40000;
do sampleid=1 to k;
 do j=1 to n;
	xuni= rand('uniform', -6, 10);
	output;
 end;
end;
keep sampleid xuni; 
run;
proc means data=Prob1A noprint;
by SampleID;
var xuni;
output out=A1means mean=SampleMean std=SampleStd;
run;
data p197_24;
set A1means;
A1sol = (1.97&amp;lt; SampleMean &amp;lt; 2.4);
run;
proc freq data= p197_24;
tables A1sol;
run;
/**1B******1C**************************************/
proc means data=A1means;
run;
/************1D**************************************/
ods select Moments Histogram;
proc univariate data=A1means;
label SampleMean = "Sample Mean of U(-6,10) Data";
var SampleMean;
histogram SampleMean; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Sorry the parameters are a bit different than the original&lt;/P&gt;</description>
    <pubDate>Sun, 20 Oct 2019 18:10:12 GMT</pubDate>
    <dc:creator>valarievil</dc:creator>
    <dc:date>2019-10-20T18:10:12Z</dc:date>
    <item>
      <title>Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597905#M172325</link>
      <description>&lt;P&gt;SO I'm new to SAS and I've been working on this HW assignment for 5 hours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Generate 200 samples of size 4000 random numbers from Uniform distribution with parameters a = -4, b = 6. For each of these 200 samples calculate the mean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Find the simulated probability that the mean is between 2 and 3.&lt;/LI&gt;&lt;LI&gt;Find the mean of the means.&lt;/LI&gt;&lt;LI&gt;Find the standard deviation of the means.&lt;/LI&gt;&lt;LI&gt;Draw the histogram of the means.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Prob1A;
call streaminit (0);
k= 200;
n= 4000;
do i=1 to k;
	xuni= rand('uniform', -4, 6);
	output;
keep xuni; 
end;
proc means data=Prob1A noprint;
by SampleID;
var xuni;
output out=1Ameans mean=SampleMean std=SampleStd;
run;
data p197_24;
set 1Ameans;
A1sol = (2&amp;lt; SampleMean &amp;lt; 3);
run;
proc freq data= p197_24;
tables A1sol;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Honestly I'm ready to scream and throw my computer out the window. I've tried seeking help, but have not been successful yet. PLEASE HELP (I might be out a $1000 laptop soon).&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 19:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597905#M172325</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-10-19T19:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597908#M172328</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294895"&gt;@valarievil&lt;/a&gt;&amp;nbsp; &amp;nbsp;Let's first get your sampling corrected. Then using the corrected sample, you can do the rest easily as those are merely copy/paste&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow the comments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data Prob1A;
call streaminit (1234567);
k= 200;/*no of samples*/
n= 4000;/*sample size*/
do sampleid=1 to k; /*200 repetitions*/
 do j=1 to n;/*1 to sample size*/ 
	xuni= rand('uniform', -4, 6);
	output;
 end;
end;
keep sampleid xuni; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, using the above try the rest&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 23:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597908#M172328</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-10-19T23:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597909#M172329</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294895"&gt;@valarievil&lt;/a&gt; you do not want to post the same question twice. This is not a good thing to do. Please everyone reply to at the other thread at &lt;A href="https://communities.sas.com/t5/SAS-Programming/Probability-that-the-sample-means-are-between-2-and-3-uniform/td-p/597903" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Probability-that-the-sample-means-are-between-2-and-3-uniform/td-p/597903&lt;/A&gt; where I have pointed out a likely cause of your trouble.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 19:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597909#M172329</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-19T19:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597911#M172331</link>
      <description>&lt;P&gt;Oh well, I didn't know this is a duplicate thread. Oops.&amp;nbsp; &amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294895"&gt;@valarievil&lt;/a&gt;, relax and do not panic about HW. I would just request you to keep it one thread. Nothing wrong in asking over and over but duplicating is not needed as it causes confusion.&amp;nbsp; But we have given you a head start, try and message back. Cheers!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS Do not break your laptop &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I have done that. It's one my deepest regret &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 19:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597911#M172331</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-10-19T19:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597916#M172336</link>
      <description>I keep getting the error "Variable A1SOL not found."&lt;BR /&gt;Why?</description>
      <pubDate>Sat, 19 Oct 2019 19:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597916#M172336</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-10-19T19:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597918#M172338</link>
      <description>&lt;P&gt;Do a proc contents of&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc contents data=p197_24;

ods select variables;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now see if that variable is listed or not&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 19:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597918#M172338</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-10-19T19:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597919#M172339</link>
      <description>&lt;P&gt;yes dupe thread. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;start with replacing your first data step with something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Prob1A;
retain SampleID 0;
call streaminit (0);
k= 200;
n= 4000;
do b = 1 to 10;
do i=1 to k;
	SampleID =b +1;
	xuni= rand('uniform', -6, 10);
	output;
keep xuni SampleID; 
end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You first of all need SampleID on the dataset.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 19:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597919#M172339</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-10-19T19:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597983#M172376</link>
      <description>What is the significance of the line "do b= 1 to 10"?</description>
      <pubDate>Sun, 20 Oct 2019 14:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597983#M172376</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-10-20T14:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597986#M172378</link>
      <description>&lt;P&gt;you need a variable named SampleID that you call in your next proc means because of the by statement.&lt;/P&gt;
&lt;P&gt;At the same time you will need to sort the dataset because of that by statement in the proc means in order for proc means to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2019 16:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597986#M172378</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-10-20T16:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Randomly Generated sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597992#M172383</link>
      <description>&lt;P&gt;Thanks for your responses! here is the correct code I made with your advice:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Prob1A;
call streaminit (47);
k= 2000;
n= 40000;
do sampleid=1 to k;
 do j=1 to n;
	xuni= rand('uniform', -6, 10);
	output;
 end;
end;
keep sampleid xuni; 
run;
proc means data=Prob1A noprint;
by SampleID;
var xuni;
output out=A1means mean=SampleMean std=SampleStd;
run;
data p197_24;
set A1means;
A1sol = (1.97&amp;lt; SampleMean &amp;lt; 2.4);
run;
proc freq data= p197_24;
tables A1sol;
run;
/**1B******1C**************************************/
proc means data=A1means;
run;
/************1D**************************************/
ods select Moments Histogram;
proc univariate data=A1means;
label SampleMean = "Sample Mean of U(-6,10) Data";
var SampleMean;
histogram SampleMean; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Sorry the parameters are a bit different than the original&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2019 18:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-Randomly-Generated-sets/m-p/597992#M172383</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-10-20T18:10:12Z</dc:date>
    </item>
  </channel>
</rss>

