<?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: how do I do this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329674#M73808</link>
    <description>&lt;P&gt;Thank you, PG Stats! This does the trick! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2017 04:05:59 GMT</pubDate>
    <dc:creator>K_S</dc:creator>
    <dc:date>2017-02-03T04:05:59Z</dc:date>
    <item>
      <title>How to randomly impute gender values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329662#M73800</link>
      <description>&lt;P&gt;What statements do I add after the DO statement to randomly impute gender values of 'F' and 'M' (with 60% of people being female).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data imputed;&lt;/P&gt;
&lt;P&gt;set missing;&lt;/P&gt;
&lt;P&gt;if geneder = ' ' then do;&lt;/P&gt;
&lt;P&gt;..........????&lt;/P&gt;
&lt;P&gt;..........????&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329662#M73800</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-03T05:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329667#M73803</link>
      <description>&lt;P&gt;The below sample code should guide you through.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input id sex $ ;
datalines ;
23 M
25 M
26 F
27 F
28 F
;
RUN ;

DATA WANT;
length Y $10. ;
set have ;
if sex='M' then do Y='Male' ;
end ;
else if sex = 'F' then do Y='Female' ;
end ;
run ;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2017 03:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329667#M73803</guid>
      <dc:creator>anoopmohandas7</dc:creator>
      <dc:date>2017-02-03T03:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329668#M73804</link>
      <description>&lt;P&gt;anoopmohandas7, that didn't help. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to replace the missing observations by generating Ms and Fs randomly in a 4 to 6 ratio....&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 03:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329668#M73804</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-03T03:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329669#M73805</link>
      <description>&lt;P&gt;Use the random number generator RAND which returns a random number uniformly distributed between 0 and 1 :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data imputed;
set missing;
if missing(gender) then 
	if rand("uniform") &amp;lt; 0.6 then gender = "F"; else gender ="M";
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Feb 2017 03:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329669#M73805</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-03T03:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329670#M73806</link>
      <description>Can you show me how your data looks like and what you expect it to be.</description>
      <pubDate>Fri, 03 Feb 2017 03:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329670#M73806</guid>
      <dc:creator>anoopmohandas7</dc:creator>
      <dc:date>2017-02-03T03:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329674#M73808</link>
      <description>&lt;P&gt;Thank you, PG Stats! This does the trick! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 04:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329674#M73808</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-03T04:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329675#M73809</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;: You're the statistician .. I'm only the Psychologist, but wouldn't LE .5 be the more appropriate cutoff?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 04:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329675#M73809</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-03T04:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329676#M73810</link>
      <description>&lt;P&gt;Please see PGStats reply for what I was looking for.&lt;/P&gt;&lt;P&gt;Thank you so much for your reply though! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 04:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329676#M73810</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-03T04:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329677#M73811</link>
      <description>&lt;P&gt;My question stated 0.6-PGStats just gave me what I asked for &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 04:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329677#M73811</guid>
      <dc:creator>K_S</dc:creator>
      <dc:date>2017-02-03T04:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329678#M73812</link>
      <description>&lt;P&gt;I hadn't seen your 4 to 6 ratio post.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;: my sincere appologies. I should have know better than to question you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 04:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329678#M73812</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-03T04:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329679#M73813</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;, you are welcome to question me any time&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 04:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329679#M73813</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-03T04:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329684#M73817</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;idea of using RAND is what I'd use, but not a Uniform Distribution, but a Bernoulli.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if rand('bernoulli', 0.6) = 1 then sex='F';
else sex='M';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329684#M73817</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-03T05:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329686#M73818</link>
      <description>&lt;P&gt;Same thing, under the hood. You could also use "&lt;EM&gt;table"&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329686#M73818</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-03T05:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329687#M73819</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Same thing, under the hood. You could also use "&lt;EM&gt;table"&lt;/EM&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I was wondering about that...it's been a while since I've studied random number generators &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329687#M73819</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-03T05:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329689#M73820</link>
      <description>&lt;P&gt;Of course, I haven't seen what's &lt;EM&gt;under the hood&lt;/EM&gt;, I can only guess. But as far as I know, all RAND generators are based on transformations of the uniform generator.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 05:25:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329689#M73820</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-03T05:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: how do I do this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329811#M73842</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Same thing, under the hood. You could also use "&lt;EM&gt;table"&lt;/EM&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I was wondering about that...it's been a while since I've studied random number generators &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But since rand('TABLE', 0.6, 0.4) would return either a 1 or 2 then you still need a conversion to the text gender value requested so I'm not sure you gain much over the If/ then/ else approach with uniform.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if gender had been coded as 1,2 (or just about any sequential pair of numbers) then that would be another story.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 15:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-randomly-impute-gender-values/m-p/329811#M73842</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-03T15:27:34Z</dc:date>
    </item>
  </channel>
</rss>

