<?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 new Race variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555428#M9679</link>
    <description>&lt;P&gt;Thank you Kurt for your response.&lt;/P&gt;&lt;P&gt;I am expecting 1 race&amp;nbsp;&lt;SPAN&gt;observation per id din the final dataset.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sackey&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 01 May 2019 17:38:48 GMT</pubDate>
    <dc:creator>sackey</dc:creator>
    <dc:date>2019-05-01T17:38:48Z</dc:date>
    <item>
      <title>Creating a new Race variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555423#M9676</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am inexperienced in SAS and need some help.&lt;/P&gt;&lt;P&gt;I am analyzing some student survey data which had a ‘race’ variable where respondents had the option to select more than one race category. Because of that I have 6 separate race variables.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Variable name&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Label&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Q3_1&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;American Indian or Alaska Native&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Q3_2&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Asian&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Q3_3&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;White&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Q3_4&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Black or African American&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Q3_5&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hispanic or Latino&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Q3_6&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Native Hawaiian or Other Pacific Islander&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I am trying to create one Race variable for analysis and want to add a category of ‘multiracial’ for any person who selects more than one Race. I will want SAS to drop the race categories (Q3_1-Q3_6) for a person who is ‘multiracial’ so that I don’t have multiple lines of data per person however I am unable to do that (highlighted section) and will appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data five;
set four;
length race $ 16;
keep id race;
if Q3_1 then do;
	race='American Indian or Alaska Native';
	output;
	end;
if Q3_2 then do;
	race='Asian';
	output;
	end;
if Q3_3 then do;
	race='White';
	output;
	end;
if Q3_4 then do;
	race='Black or African American';
	output;
	end;
if Q3_5 then do;
	race='Hispanic or latino';
	output;
	end;
if Q3_6 then do;
	race='Native Hawaiian or Other Pacific Islander';
	output;
	end;

if q3_3 and q3_5 then do;
	race='multiracial';
	drop q3_3 q3_5;
	output;
	end; 
run;

data six;
merge four five;
by id;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:20:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555423#M9676</guid>
      <dc:creator>sackey</dc:creator>
      <dc:date>2019-05-01T17:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Race variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555425#M9677</link>
      <description>&lt;P&gt;You cannot selectively drop variables. Both variables will be dropped from dataset five.&lt;/P&gt;
&lt;P&gt;By merging back with the original dataset four, you will get them back anyway.&lt;/P&gt;
&lt;P&gt;How many observations per id do you expect in the final dataset?&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555425#M9677</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-01T17:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Race variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555426#M9678</link>
      <description>&lt;P&gt;How are the current variables coded?&lt;/P&gt;
&lt;P&gt;Do they have value of 1 if selected and 0 if not?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length race $40;
if sum(of Q3_1 - Q3_6) &amp;gt; 1 then race='Multiracial';
else if Q3_1 then race='American Indian or Alaska Native';
else if Q3_2 then race='Asian';
else if Q3_3 then race='White';
else if Q3_4 then race='Black or African American';
else if Q3_5 then race='Hispanic or latino';
else if Q3_6 then race='Native Hawaiian or Other Pacific Islander';
else race='No response';
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2019 17:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555426#M9678</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-01T17:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Race variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555428#M9679</link>
      <description>&lt;P&gt;Thank you Kurt for your response.&lt;/P&gt;&lt;P&gt;I am expecting 1 race&amp;nbsp;&lt;SPAN&gt;observation per id din the final dataset.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sackey&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555428#M9679</guid>
      <dc:creator>sackey</dc:creator>
      <dc:date>2019-05-01T17:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new Race variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555433#M9680</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;&lt;P&gt;Thank you so much for your solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sackey&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 17:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-Race-variable/m-p/555433#M9680</guid>
      <dc:creator>sackey</dc:creator>
      <dc:date>2019-05-01T17:43:52Z</dc:date>
    </item>
  </channel>
</rss>

