<?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: simulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758938#M239715</link>
    <description>&lt;P&gt;Small example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
person = "A"; meanlog = -0.1; sdlog = 0.5; output;
person = "B"; meanlog = 0.1; sdlog = 0.7; output;
run;

data want;
call streaminit(9768765);
set have;
array itemTime{5}; /* replace by 150 */
do i = 1 to dim(itemTime);
    itemTime{i} = rand("lognormal", meanLog, sdLog);
    end;
drop i;
format itemTime: 7.2;
run;

proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PGStats_0-1627959491398.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62207iA3400C769F0D3DAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="PGStats_0-1627959491398.png" alt="PGStats_0-1627959491398.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 02:58:36 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2021-08-03T02:58:36Z</dc:date>
    <item>
      <title>simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758890#M239697</link>
      <description>&lt;P&gt;I have 1000 person, each of the person answered 150 items. I have mean and sd of response time on each of 150 items. Using those information, I want to simulate response time of those 1000 person on 150 items. How should I do that in SAS?&lt;/P&gt;
&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 20:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758890#M239697</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-08-02T20:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758907#M239703</link>
      <description>&lt;P&gt;What do you mean by "simulate" in this case? You description makes it sound like you already have 1000 respondents actual responses. So what would a simulation gain you?&lt;/P&gt;
&lt;P&gt;Or are you trying to generate 1000 other records that aren't from actual people as an exercise?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have the mean and SD in a data set?&lt;/P&gt;
&lt;P&gt;Do you have any sort of idea what distribution the original data follows?&lt;/P&gt;
&lt;P&gt;The RAND function can create values from many distributions but only a few use mean and/or standard deviation directly as parameters. If the data were normally distributed (or "close") you can generate values using x= Rand('normal',mean,sd); Which might work but you need to have something that holds 150 pairs of values, such as arrays, to access them easily.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 21:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758907#M239703</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-02T21:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758935#M239713</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks much for your reply!&lt;/P&gt;
&lt;P&gt;I have a dataset contains mean and sd of response time for 150 items. The mean and sd is after lognormal transformation. I am trying to simulate 1000 people's response time on 150 items based on the mean and sd dataset.&lt;/P&gt;
&lt;P&gt;I understand the function&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;x= Rand('normal',mean,sd) you mentioned. I am having difficulty of incorporating 150 means and sd into this function, the arrays as you said. Can you please provide more information/example SAS code?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 02:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758935#M239713</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-08-03T02:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758938#M239715</link>
      <description>&lt;P&gt;Small example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
person = "A"; meanlog = -0.1; sdlog = 0.5; output;
person = "B"; meanlog = 0.1; sdlog = 0.7; output;
run;

data want;
call streaminit(9768765);
set have;
array itemTime{5}; /* replace by 150 */
do i = 1 to dim(itemTime);
    itemTime{i} = rand("lognormal", meanLog, sdLog);
    end;
drop i;
format itemTime: 7.2;
run;

proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PGStats_0-1627959491398.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62207iA3400C769F0D3DAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="PGStats_0-1627959491398.png" alt="PGStats_0-1627959491398.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 02:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758938#M239715</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-08-03T02:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758939#M239716</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my trial for 1000 people's response time on the first item. I have data contains mu and sigma for 150 items. Could you please direct me how to use array function to incorporate&amp;nbsp;mu and sigma for 150 items into the code below? Many thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%Let person = 1000; 
%Let mu = 53.6692552122;
%Let sigma = 0.5671923308;
%Let norm = rand('normal',&amp;amp;mu, &amp;amp;sigma);
data RandomNormal;
 do x=1 to &amp;amp;person; 
 time=&amp;amp;norm;
 output;
 end; 

 proc print data=RandomNormal; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Aug 2021 02:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/758939#M239716</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-08-03T02:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759099#M239816</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a bunch for your help!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 17:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759099#M239816</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-08-03T17:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759422#M239997</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to the code you helped, if I want to generated item time for 1000 person on 150 items, how should incorporate the information of 1000 into the code?&amp;nbsp; Can you please provide more direction? Thanks much!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 17:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759422#M239997</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-08-04T17:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759471#M240016</link>
      <description>&lt;P&gt;You must create a dataset with variables Person, meanLog and stdLog. I guess that this data could be extracted from the data you already have. I can't be more precise unless I know what your data looks like.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 19:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759471#M240016</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-08-04T19:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759501#M240024</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks much for your reply!&lt;/P&gt;
&lt;P&gt;I figured out I must prepare the data as your recommended in order to easily apply the code you helped.&lt;/P&gt;
&lt;P&gt;Very much appreciate your help and expertise!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 20:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/simulation/m-p/759501#M240024</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-08-04T20:27:46Z</dc:date>
    </item>
  </channel>
</rss>

