<?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: Simulating data with known distributions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730126#M227312</link>
    <description>&lt;P&gt;I modified your subject line to be more descriptive and removed the text of your question from a code block, that should be used for code or data not text.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You really should also know the relationship between the variables but assuming what you stated is all you have something like the following will get you started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data randomData;

*random seed to ensure reproducible results for testing;
call streaminit(55);

array probFormula(3)$  _temporary_ ("F1", "F2", "F3");
array probSex(2) $ _temporary_ ("M", "F");
array probSalary(2) _temporary_ (3000, 2000);

*number of observations = 5000;
do i=1 to 5000;
formula = probFormula(rand('table', 0.5, 0.2, 0.3));
Sex = probSex(rand('table', 0.7, 0.3));
Salary = probSalary(rand('table', 0.5, 0.5));
output;
end;

drop i;

run;

*check distribution;
proc freq data=randomData;
table formula sex salary;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/376158"&gt;@Jaji&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So my research is: I want to create a table of 5000 observations with 3 variables (formula, sex, salary). Now in the formula variable: I have 50% of the observations being F1, 20% or F2 and 30% or F3. In the sex variable: 70% or men and 30% women. Finally the salary: 50% earn 3000 euros and 50% 2000 euros. This is basically what I'm looking for.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 15:57:13 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-03-30T15:57:13Z</dc:date>
    <item>
      <title>Simulating data with known distributions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730121#M227309</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So my research is: I want to create a table of 5000 observations with 3 variables (formula, sex, salary). Now in the formula variable: I have 50% of the observations being F1, 20% or F2 and 30% or F3. In the sex variable: 70% or men and 30% women. Finally the salary: 50% earn 3000 euros and 50% 2000 euros. This is basically what I'm looking for.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 15:45:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730121#M227309</guid>
      <dc:creator>Jaji</dc:creator>
      <dc:date>2021-03-30T15:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating data with known distributions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730126#M227312</link>
      <description>&lt;P&gt;I modified your subject line to be more descriptive and removed the text of your question from a code block, that should be used for code or data not text.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You really should also know the relationship between the variables but assuming what you stated is all you have something like the following will get you started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data randomData;

*random seed to ensure reproducible results for testing;
call streaminit(55);

array probFormula(3)$  _temporary_ ("F1", "F2", "F3");
array probSex(2) $ _temporary_ ("M", "F");
array probSalary(2) _temporary_ (3000, 2000);

*number of observations = 5000;
do i=1 to 5000;
formula = probFormula(rand('table', 0.5, 0.2, 0.3));
Sex = probSex(rand('table', 0.7, 0.3));
Salary = probSalary(rand('table', 0.5, 0.5));
output;
end;

drop i;

run;

*check distribution;
proc freq data=randomData;
table formula sex salary;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/376158"&gt;@Jaji&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So my research is: I want to create a table of 5000 observations with 3 variables (formula, sex, salary). Now in the formula variable: I have 50% of the observations being F1, 20% or F2 and 30% or F3. In the sex variable: 70% or men and 30% women. Finally the salary: 50% earn 3000 euros and 50% 2000 euros. This is basically what I'm looking for.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 15:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730126#M227312</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-30T15:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating data with known distributions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730130#M227315</link>
      <description>&lt;P&gt;Thank very much. Your code will help me.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 16:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730130#M227315</guid>
      <dc:creator>Jaji</dc:creator>
      <dc:date>2021-03-30T16:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Simulating data with known distributions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730382#M227434</link>
      <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 12:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulating-data-with-known-distributions/m-p/730382#M227434</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-31T12:31:59Z</dc:date>
    </item>
  </channel>
</rss>

