<?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 assign a variable value to an other variable under condition in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435046#M28133</link>
    <description>&lt;P&gt;will this help?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if txtype ne quote_credit then do;
policy_credit=creditedby;
call missing(quote_credit);
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Feb 2018 20:37:31 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-02-07T20:37:31Z</dc:date>
    <item>
      <title>how to assign a variable value to an other variable under condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435045#M28132</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with few variables.&amp;nbsp; 4&amp;nbsp;of those (string variables) are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;createdby&lt;/P&gt;&lt;P&gt;policy_credit&lt;/P&gt;&lt;P&gt;quote_credit&lt;/P&gt;&lt;P&gt;txtype.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When txtype ne 'quote' I would like to take the value of creditedby and put it into policy_credit then set quote_credit to empty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Soumweb1A;&lt;BR /&gt;set SoumWeb1;&lt;BR /&gt;if txtype eq 'policy' then policy_credit = updatedby;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is note working, Why?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435045#M28132</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-02-07T20:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to assign a variable value to an other variable under condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435046#M28133</link>
      <description>&lt;P&gt;will this help?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if txtype ne quote_credit then do;
policy_credit=creditedby;
call missing(quote_credit);
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435046#M28133</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-07T20:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to assign a variable value to an other variable under condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435049#M28134</link>
      <description>&lt;P&gt;I have try your code and it is not working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have try the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; txtype &lt;SPAN class="token operator"&gt;ne&lt;/SPAN&gt; quote_credit &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; do&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
policy_credit&lt;SPAN class="token operator"&gt;='test' &lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and it works.&amp;nbsp; But for some reason I don't know, I am not able to assign the value of creditedby to policy_credit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;creditedby = 'aaa1234';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435049#M28134</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-02-07T20:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to assign a variable value to an other variable under condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435050#M28135</link>
      <description>&lt;P&gt;post a sample of your input data and your wanted output&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435050#M28135</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-07T20:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to assign a variable value to an other variable under condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435053#M28136</link>
      <description>&lt;P&gt;"Not working" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the value of the variable updatedby? What type is it (numeric or character) and what is its length? And why are you using it instead of creditedby (or possibly createdby)?&lt;/P&gt;
&lt;P&gt;What type of variable is policy_credit (numeric or character) and what is its length?&lt;/P&gt;
&lt;P&gt;What type of variable is creditedby (or is this supposed to be createdby) (numeric or character) and what is its length?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Types are important as numeric variables can't contain text. Text variables can be assigned values from numeric but the conversion may leave something to be desired depending on values and variable properties. If the text variable has a length of 3 and you try to stuff more characters into it from a longer variable the values will be truncated. With no error or warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am assuming that you are actually using a value of "policy" that exists in your data variable txtype. Note that a policy number like 'abc123' is not equal to 'ABC123'.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435053#M28136</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-07T20:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to assign a variable value to an other variable under condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435065#M28137</link>
      <description>&lt;P&gt;I have found my mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 20:58:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-assign-a-variable-value-to-an-other-variable-under/m-p/435065#M28137</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-02-07T20:58:50Z</dc:date>
    </item>
  </channel>
</rss>

