<?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 to transfer values from one variable to another in context of missing data in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-transfer-values-from-one-variable-to-another-in-context/m-p/551591#M9023</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268580"&gt;@bretthouston&lt;/a&gt;&amp;nbsp;and welcome to the community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure I see the problem here as the code you've got works for empty strings too (I also think given your logic observation number 3 should have adj_color as "Blue" not "Other").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the example data I used&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="," dsd missover truncover;
	length color $6 default $6;
	input color default;
datalines;
"Blue","Other"
"Teal","Other"
"Teal","Other"
"Yellow","Other"
"Orange","Other"
"","Other"
;
run;

data want;
	length adj_color $6;
	set have;
	if color="Blue" or color="Teal" then adj_color="Blue";
	else adj_color=default;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I've misunderstood what you want please let us know&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2019 23:43:09 GMT</pubDate>
    <dc:creator>ChrisBrooks</dc:creator>
    <dc:date>2019-04-16T23:43:09Z</dc:date>
    <item>
      <title>How to transfer values from one variable to another in context of missing data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-transfer-values-from-one-variable-to-another-in-context/m-p/551585#M9021</link>
      <description>&lt;P&gt;SAS beginner using SAS Studio interface. I have the following sample dataset, and I'm having difficulties with the last step of the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs&amp;nbsp; &amp;nbsp; &amp;nbsp;Color&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; Default&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Blue&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; &amp;nbsp; Other&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Teal&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; &amp;nbsp; &amp;nbsp;Other&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Teal&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; &amp;nbsp; &amp;nbsp;Other&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yellow&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;Other&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Orange&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;Other&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.adjcolor;&lt;/P&gt;&lt;P&gt;set library.color;&lt;/P&gt;&lt;P&gt;if Color="Blue" or Color="Teal" then Adj_color="Blue;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;else adj_color=default&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;run;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adj_color is a new column I've created. What I would like to do is say "if adj_color" is missing/empty, then input values from 'default' into 'adj_color'." (So Adj_color when completed would have obs 1-5 'blue, blue, other, other, other'.'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realize this is likely very basic, but I haven't been able to figure this out. Any help would be much much appreciated! Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 23:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-transfer-values-from-one-variable-to-another-in-context/m-p/551585#M9021</guid>
      <dc:creator>bretthouston</dc:creator>
      <dc:date>2019-04-16T23:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to transfer values from one variable to another in context of missing data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-transfer-values-from-one-variable-to-another-in-context/m-p/551591#M9023</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268580"&gt;@bretthouston&lt;/a&gt;&amp;nbsp;and welcome to the community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure I see the problem here as the code you've got works for empty strings too (I also think given your logic observation number 3 should have adj_color as "Blue" not "Other").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the example data I used&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="," dsd missover truncover;
	length color $6 default $6;
	input color default;
datalines;
"Blue","Other"
"Teal","Other"
"Teal","Other"
"Yellow","Other"
"Orange","Other"
"","Other"
;
run;

data want;
	length adj_color $6;
	set have;
	if color="Blue" or color="Teal" then adj_color="Blue";
	else adj_color=default;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I've misunderstood what you want please let us know&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 23:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-transfer-values-from-one-variable-to-another-in-context/m-p/551591#M9023</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2019-04-16T23:43:09Z</dc:date>
    </item>
  </channel>
</rss>

