<?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 Simulating Data from Standard Normal Distribution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/553404#M153892</link>
    <description>&lt;DIV class="textLayer--absolute"&gt;First I create a 100 obs dataset with a DO...End loop with the variable x. And then I use another DO loop of 600&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;rounds to generate a total of 600 samples, 100 obs each. And then I use a proc means step to calculate the sample mean of x for each sample. So my goal is to have a total of 600 sample means (Each sample containing 100 obs) and then find out the mean of these sample means.&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;Here is my code:&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample(keep=X);
	call streaminit(123);
	do j=1 to 600;
		do i=1 to 100;
			X = rand("Normal");
			output;
		end;
	end;
run;

proc means data=sample;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get a total of 60,000 observations but want 600 sample means. The proc means statement gives the mean for all 60,000 obs.&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 23 Apr 2019 20:11:59 GMT</pubDate>
    <dc:creator>ddpatel</dc:creator>
    <dc:date>2019-04-23T20:11:59Z</dc:date>
    <item>
      <title>Simulating Data from Standard Normal Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/553404#M153892</link>
      <description>&lt;DIV class="textLayer--absolute"&gt;First I create a 100 obs dataset with a DO...End loop with the variable x. And then I use another DO loop of 600&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;rounds to generate a total of 600 samples, 100 obs each. And then I use a proc means step to calculate the sample mean of x for each sample. So my goal is to have a total of 600 sample means (Each sample containing 100 obs) and then find out the mean of these sample means.&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;Here is my code:&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="textLayer--absolute"&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample(keep=X);
	call streaminit(123);
	do j=1 to 600;
		do i=1 to 100;
			X = rand("Normal");
			output;
		end;
	end;
run;

proc means data=sample;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get a total of 60,000 observations but want 600 sample means. The proc means statement gives the mean for all 60,000 obs.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 Apr 2019 20:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/553404#M153892</guid>
      <dc:creator>ddpatel</dc:creator>
      <dc:date>2019-04-23T20:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating Data from Standard Normal Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/553405#M153893</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261558"&gt;@ddpatel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="textLayer--absolute"&gt;First I create a 100 obs dataset with a DO...End loop with the variable x. And then I use another DO loop of 600&lt;/DIV&gt;
&lt;DIV class="textLayer--absolute"&gt;rounds to generate a total of 600 samples, 100 obs each. And then I use a proc means step to calculate the sample mean of x for each sample. So my goal is to have a total of 600 sample means (Each sample containing 100 obs) and then find out the mean of these sample means.&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="textLayer--absolute"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="textLayer--absolute"&gt;Here is my code:&lt;/DIV&gt;
&lt;DIV class="textLayer--absolute"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="textLayer--absolute"&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample(keep=X);
	call streaminit(123);
	do j=1 to 600;
		do i=1 to 100;
			X = rand("Normal");
			output;
		end;
	end;
run;

proc means data=sample;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get a total of 60,000 observations but want 600 sample means. The proc means statement gives the mean for all 60,000 obs.&lt;/P&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Use this code to get a mean for each of the 600 values of j.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
	call streaminit(123);
	do j=1 to 600;
		do i=1 to 100;
			X = rand("Normal");
			output;
		end;
	end;
run;
proc summary data=sample nway;
    class j;
    var x;
    output out=want mean=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2019 20:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/553405#M153893</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-23T20:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating Data from Standard Normal Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/777400#M247313</link>
      <description>&lt;P&gt;Would anyone be willing to explain to me why the "mean=" at the end is necessary? I had to do basically this on an assignment. Without the mean=, it gave me 3000 results instead of 600. I tried searching the SAS documentation for an explanation and couldn't find anything useful...&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 20:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/777400#M247313</guid>
      <dc:creator>Springheart</dc:creator>
      <dc:date>2021-10-29T20:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating Data from Standard Normal Distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/777488#M247364</link>
      <description>&lt;P&gt;The OUTPUT statement requests the statistics that you want to save in the output data set. In this case, you are requesting the mean statistic for each j, where j=1..600.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might be more familiar with PROC MEANS than PROC SUMMARY. If so, here is an equivalent way to produce the 600 sample means:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=sample noprint;
    by j;
    var x;
    output out=want mean=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Oct 2021 10:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-Data-from-Standard-Normal-Distribution/m-p/777488#M247364</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-10-30T10:18:06Z</dc:date>
    </item>
  </channel>
</rss>

