<?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: Randomly assigning a small category to other categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824996#M325842</link>
    <description>Thanks for your advice.</description>
    <pubDate>Fri, 22 Jul 2022 18:36:47 GMT</pubDate>
    <dc:creator>ting1</dc:creator>
    <dc:date>2022-07-22T18:36:47Z</dc:date>
    <item>
      <title>Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824867#M325793</link>
      <description>&lt;P&gt;I have a dataset from a survey. The question about gender is:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What is your gender?&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; Male&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; Female&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; Transgender&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;99&amp;nbsp;&amp;nbsp;&amp;nbsp; Prefer not to answer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;The frequency (cell-count) for option 3 (transgender ) is less than 10. I would like to assign value of option 3 (transgender) to option 1 or 2 randomly. Any one has suggestions on how to randomly assigning a small category to other categories?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your help in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 11:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824867#M325793</guid>
      <dc:creator>ting1</dc:creator>
      <dc:date>2022-07-22T11:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824869#M325794</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if gender=3 then gender = rand('uniform')&amp;lt;0.5 + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I add that I am skeptical about this being a statistically valid thing to do, you should be concerned about that and entertain (perhaps) more valid ways to handle this, such as just leaving gender=3 out of your analysis. In the end, you (not anyone else) have to vouch for this being an acceptable method.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 12:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824869#M325794</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-22T12:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824870#M325795</link>
      <description>Why reassign a small but probably atypical sample to a large category, thereby probably artificially increasing the within-group variance in the variables of interest?</description>
      <pubDate>Fri, 22 Jul 2022 12:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824870#M325795</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-07-22T12:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824871#M325797</link>
      <description>Thank you very much for the quick answer.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However, it looks like the method assign all the value of category 3 to category 1. Before running the code&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;QGENDER&lt;BR /&gt;QGENDER&lt;BR /&gt;Frequency&lt;BR /&gt;Percent&lt;BR /&gt;Cumulative&lt;BR /&gt;Frequency&lt;BR /&gt;Cumulative&lt;BR /&gt;Percent&lt;BR /&gt;1&lt;BR /&gt;1000&lt;BR /&gt;49.53&lt;BR /&gt;1000&lt;BR /&gt;49.53&lt;BR /&gt;2&lt;BR /&gt;985&lt;BR /&gt;48.79&lt;BR /&gt;1985&lt;BR /&gt;98.32&lt;BR /&gt;3&lt;BR /&gt;34&lt;BR /&gt;1.68&lt;BR /&gt;2019&lt;BR /&gt;100.00&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;After running the code:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if gender=3 then gender = rand('uniform')&amp;lt;0.5 + 1;&lt;BR /&gt;run;&lt;BR /&gt;QGENDER&lt;BR /&gt;QGENDER&lt;BR /&gt;Frequency&lt;BR /&gt;Percent&lt;BR /&gt;Cumulative&lt;BR /&gt;Frequency&lt;BR /&gt;Cumulative&lt;BR /&gt;Percent&lt;BR /&gt;1&lt;BR /&gt;1034&lt;BR /&gt;51.21&lt;BR /&gt;1034&lt;BR /&gt;51.21&lt;BR /&gt;2&lt;BR /&gt;985&lt;BR /&gt;48.79&lt;BR /&gt;2019&lt;BR /&gt;100.00&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there a way to assign some values of category 3 to category 2?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Jul 2022 12:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824871#M325797</guid>
      <dc:creator>ting1</dc:creator>
      <dc:date>2022-07-22T12:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824882#M325804</link>
      <description>&lt;P&gt;My mistake. I left out parentheses. Try it this way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if gender=3 then gender = (rand('uniform')&amp;lt;0.5) + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2022 13:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824882#M325804</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-22T13:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824884#M325805</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 13:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824884#M325805</guid>
      <dc:creator>ting1</dc:creator>
      <dc:date>2022-07-22T13:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824915#M325818</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80132"&gt;@ting1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt; I would like to assign value of option 3 (transgender) to option 1 or 2 randomly. Any one has suggestions on how to randomly assigning a small category to other categories?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;From a representation and inclusion standpoint, this is not something that should be done and is in fact the opposite. Please do not do this. If you do put a giant warning around your analysis so that people know you did this and your results are not representative. Also, do not collect information if you don't know how you're planning to use it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 15:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824915#M325818</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-22T15:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824989#M325838</link>
      <description>&lt;P&gt;I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; . IF I were &lt;STRONG&gt;forced&lt;/STRONG&gt; to treat your 3 as a different value on that scale then I would be more likely to combine the 99 and 3 codes. Which would be easily done with a format and not lose any information in the data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value gender_r&lt;/P&gt;
&lt;P&gt;1='Male'&lt;/P&gt;
&lt;P&gt;2='Female'&lt;/P&gt;
&lt;P&gt;3,99='Trans/ Prefer not to Answer'&amp;nbsp; /* or some other text */&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use that format gender_r with your gender variable for any summary statistics, reporting or graphing purpose in SAS procedures.&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 17:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824989#M325838</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-22T17:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824996#M325842</link>
      <description>Thanks for your advice.</description>
      <pubDate>Fri, 22 Jul 2022 18:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824996#M325842</guid>
      <dc:creator>ting1</dc:creator>
      <dc:date>2022-07-22T18:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Randomly assigning a small category to other categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824997#M325843</link>
      <description>Thanks!</description>
      <pubDate>Fri, 22 Jul 2022 18:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Randomly-assigning-a-small-category-to-other-categories/m-p/824997#M325843</guid>
      <dc:creator>ting1</dc:creator>
      <dc:date>2022-07-22T18:37:04Z</dc:date>
    </item>
  </channel>
</rss>

