<?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: Creating a synthetic dataset with a maximum weight from a population count in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598366#M18258</link>
    <description>&lt;P&gt;Does this do it?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input agegr edu $ SEX :$1. region :$15. Population;
datalines;
0 e1 0 AD_rural 2180000
0 e1 0 AD_urban 1084307
0 e1 0 AN_rural 9476
0 e1 0 AN_urban 5178
0 e1 0 AR_rural 58663
0 e1 0 AR_urban 13887
;

data want;
set have;
weight = min(10000,population);
gross_weight = weight;
do while (gross_weight &amp;lt; population);
  output;
  weight = min(10000,population - gross_weight);
  gross_weight = gross_weight + weight;
end;
output;
keep agegr edu SEX region weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Oct 2019 10:51:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-10-22T10:51:42Z</dc:date>
    <item>
      <title>Creating a synthetic dataset with a maximum weight from a population count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598349#M18255</link>
      <description>&lt;P&gt;I want to create a synthetic data that is representative of a population by age, sex, region and education. The original table looks like this (see attached for the full file):&lt;/P&gt;
&lt;TABLE width="320"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;agegr&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;edu&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;SEX&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;region&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;Population&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;e1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;AD_rural&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;2180000&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;e1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;AD_urban&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;1084307&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;e1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;AN_rural&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;9476&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;e1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;AN_urban&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;5178&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;e1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;AR_rural&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;58663&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;e1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;AR_urban&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;13887&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;E6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;WB_rural&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="64"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the synthetic dataset, the weight of each individual should not be higher than 10,000. This means that I should create 218 individuals having the first set of variable (agegr=0, edu=e1, sex=0, AD_rural), each of them having a weight of 10,000.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 09:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598349#M18255</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2019-10-22T09:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a synthetic dataset with a maximum weight from a population count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598350#M18256</link>
      <description>&lt;P&gt;I don't see a weight variable?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 09:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598350#M18256</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-22T09:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a synthetic dataset with a maximum weight from a population count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598351#M18257</link>
      <description>There is none. The weight is now 1 for all line, since it's a population count.</description>
      <pubDate>Tue, 22 Oct 2019 09:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598351#M18257</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2019-10-22T09:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a synthetic dataset with a maximum weight from a population count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598366#M18258</link>
      <description>&lt;P&gt;Does this do it?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input agegr edu $ SEX :$1. region :$15. Population;
datalines;
0 e1 0 AD_rural 2180000
0 e1 0 AD_urban 1084307
0 e1 0 AN_rural 9476
0 e1 0 AN_urban 5178
0 e1 0 AR_rural 58663
0 e1 0 AR_urban 13887
;

data want;
set have;
weight = min(10000,population);
gross_weight = weight;
do while (gross_weight &amp;lt; population);
  output;
  weight = min(10000,population - gross_weight);
  gross_weight = gross_weight + weight;
end;
output;
keep agegr edu SEX region weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Oct 2019 10:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-synthetic-dataset-with-a-maximum-weight-from-a/m-p/598366#M18258</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-22T10:51:42Z</dc:date>
    </item>
  </channel>
</rss>

