<?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 using SAS in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463622#M4181</link>
    <description>&lt;P&gt;this code in case of the uni-variate data&amp;nbsp; but i need the code&amp;nbsp; in the case of multivariate&amp;nbsp; data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 20 May 2018 10:23:00 GMT</pubDate>
    <dc:creator>GehadElsayed123</dc:creator>
    <dc:date>2018-05-20T10:23:00Z</dc:date>
    <item>
      <title>Simulation using SAS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/454982#M4126</link>
      <description>&lt;P&gt;i try to do codes of " phase one analysis of multivariate control charts with missing data "&lt;/P&gt;&lt;P&gt;i do first and second steps&amp;nbsp;&lt;/P&gt;&lt;P&gt;but i stop in the third step , as i should remove k% from data by (general pattern and MCAR)&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT i can't do it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to know , how to make k% missing values from simulated data&amp;nbsp; ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 01:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/454982#M4126</guid>
      <dc:creator>GehadElsayed123</dc:creator>
      <dc:date>2018-04-18T01:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation using SAS [how to improve your question]</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/454991#M4127</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197204"&gt;@GehadElsayed123&lt;/a&gt;,&lt;/P&gt;&lt;BR /&gt; &lt;P&gt;Your question requires more details before experts can help.&amp;nbsp;Can you revise your question to include more information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review this checklist:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Specify a meaningful subject line for your topic.&amp;nbsp; Avoid generic subjects like "need help," "SAS query," or "urgent."&lt;/LI&gt;
&lt;LI&gt;When appropriate, provide sample data in text or DATA step format.&amp;nbsp; See &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;this article for one method&lt;/A&gt;&amp;nbsp;you can use.&lt;/LI&gt;
&lt;LI&gt;If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition.&amp;nbsp;Use the&amp;nbsp;&lt;STRONG&gt;Photos&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to include the image in your message.&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 279px;"&gt;&lt;IMG src="https://kntur85557.i.lithium.com/t5/image/serverpage/image-id/16608i91A52F817EAC9A69/image-dimensions/279x150?v=1.0" width="279" height="150" alt="use_buttons.png" title="use_buttons.png" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;It also helps to include an example (table or picture) of the result that you're trying to achieve.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To edit your original message, select the "blue gear" icon at the top of the message and select&amp;nbsp;&lt;STRONG&gt;Edit Message&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;From there you can adjust the title and add more details to the body of the message.&amp;nbsp; Or, simply reply to this message with any additional information you can supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 229px;"&gt;&lt;IMG src="https://kntur85557.i.lithium.com/t5/image/serverpage/image-id/16605iAC020BC79315B045/image-size/large?v=1.0&amp;amp;px=600" alt="edit_post.png" title="edit_post.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SAS experts are eager to help -- help&amp;nbsp;&lt;EM&gt;them&lt;/EM&gt; by providing as much detail as you can.&lt;/P&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style:italic;font-size:smaller;"&gt;This prewritten response was triggered for you by fellow SAS Support Communities member &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;.</description>
      <pubDate>Wed, 18 Apr 2018 01:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/454991#M4127</guid>
      <dc:creator>Community_Guide</dc:creator>
      <dc:date>2018-04-18T01:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation using SAS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/455317#M4129</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
call randseed(1);
N = 100;        /* number of time points */
t = 1:N;
X = j(1, N);    /* allocate vector */
call randgen(X, "Normal"); /* fill with random normal variates */

/* approximately 20% missing completely at random */
missIdx = sample( t, 0.2*N );   /* sample with replacement */
X[missIdx] = .;
call scatter(t, X) other="refline 0/axis=y;";


/* or sample witout replacement to get exactly 20% missing */
missIdx = sample( t, 0.2*N, "NoReplace" );
X[missIdx] = .;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Apr 2018 17:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/455317#M4129</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-04-18T17:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation using SAS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463622#M4181</link>
      <description>&lt;P&gt;this code in case of the uni-variate data&amp;nbsp; but i need the code&amp;nbsp; in the case of multivariate&amp;nbsp; data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 10:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463622#M4181</guid>
      <dc:creator>GehadElsayed123</dc:creator>
      <dc:date>2018-05-20T10:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation using SAS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463626#M4182</link>
      <description>&lt;P&gt;Use the same program, where N = rows*columns is the total number of&amp;nbsp;elements in the matrix. For example, if you want a 5x20 matrix use the previous code with N=100 and then reshape the vector into a matrix by using the SHAPE function:&lt;/P&gt;
&lt;P&gt;Y = shape(X, 5, 20); /* convert to matrix */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you prefer to rewrite the whole program in terms of rows and columns, you can do that, too:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
call randseed(1);
N = 100;        /* number of time points (columns) */
p = 5;          /* number of rows */
X = j(p, N);    /* allocate matrix */
call randgen(X, "Normal"); /* fill with random normal variates */

/* approximately 20% missing completely at random */
t = 1:(N*p);    /* vector that contains all indices */
missIdx = sample( t, 0.2*N*p );   /* sample with replacement */
X[missIdx] = .;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you plan on doing a lot of simulations, I recommend the book &lt;A href="https://support.sas.com/en/books/authors/rick-wicklin.html" target="_self"&gt;&lt;EM&gt;Simulating Data with SAS&lt;/EM&gt;&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 10:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463626#M4182</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-05-20T10:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation using SAS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463634#M4183</link>
      <description>&lt;P&gt;i do it but i get error&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 14:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463634#M4183</guid>
      <dc:creator>GehadElsayed123</dc:creator>
      <dc:date>2018-05-20T14:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Simulation using SAS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463654#M4184</link>
      <description>&lt;P&gt;1. Do you want uncorrelated or correlated observations? It looks like you are trying to&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2011/01/12/sampling-from-the-multivariate-normal-distribution.html" target="_self"&gt;use the RANDNORMAL function&lt;/A&gt;. If so, see the program below for the correct syntax.&lt;/P&gt;
&lt;P&gt;2. The second argument to &lt;A href="https://blogs.sas.com/content/iml/2014/01/23/sampling-with-replacement-easier.html" target="_self"&gt;the SAMPLE function&amp;nbsp;&lt;/A&gt;is the&amp;nbsp;sample size, which is the number of indices in the range 1:n*p. This value must be greater than zero.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
mean={0 0};
cov={1 0,
     0 1};
p = ncol(mean);  /* number of variables */
m=20;            /* number of observations */
X=randnormal(m,mean,cov); /* multivariate normal */

t= 1:(m*p);
/* 2nd argument is not a probability, it is the number of times to 
   sample from t. Therefore the second argument must be an integer &amp;gt; 0 */
missIdx= sample(t, round(0.1*m*p) );  
X[missIdx]=.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to allow the possibility that no elements are&amp;nbsp;set to missing, you can use a different method for generating the missing values. In the following statements, an nxp&amp;nbsp;random matrix is generated where&amp;nbsp;each cell has probability=0.01 of being 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Different approach: Each cell has 0.01 probability of being missing. */
B = j(m, p);
call randgen(B, "Bernoulli", 0.01);
missIdx=loc(B=1);
if ncol(idx)&amp;gt;0 then X[missIdx]=.;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 May 2018 19:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Simulation-using-SAS/m-p/463654#M4184</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-05-20T19:55:21Z</dc:date>
    </item>
  </channel>
</rss>

