<?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: Modify a value in the data step with same variable name in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179598#M45819</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have used type instead of id in the if condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data test1;&lt;BR /&gt; merge test(in=in1) lk;&lt;BR /&gt; by id;&lt;BR /&gt;if in1;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; if id in (1,2) then type=5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; else if id ^= 3 then type=.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=test1; tables&amp;nbsp; type/list missing; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please used the above code to get the desired result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Dec 2013 18:20:04 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2013-12-20T18:20:04Z</dc:date>
    <item>
      <title>Modify a value in the data step with same variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179596#M45817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Happy Holidays!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please explain why the value TYPE after the modification couldn’t give correct answer?&amp;nbsp; The correct answer should be like this but the code didn't give this.&amp;nbsp; Why?&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;Type Frequency&lt;/P&gt;&lt;P&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3&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; 1&lt;/P&gt;&lt;P&gt;5&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; 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data lk;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; input id type;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1&lt;BR /&gt;2 2&lt;BR /&gt;3 3&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt; data test;&lt;BR /&gt;input id;&lt;BR /&gt;datalines;&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt; data test1;&lt;BR /&gt; merge test(in=in1) lk;&lt;BR /&gt; by id;&lt;BR /&gt;if in1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if type in (1,2) then type=5;&lt;BR /&gt;&amp;nbsp; else if type ^= 3 then type=.;&lt;BR /&gt;run;&lt;BR /&gt;proc freq data=test1; tables&amp;nbsp; type/list missing; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 17:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179596#M45817</guid>
      <dc:creator>Ying</dc:creator>
      <dc:date>2013-12-20T17:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a value in the data step with same variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179597#M45818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are retaining the modified value.&amp;nbsp; It will do as you expect if you use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test1 (drop=_type);&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge test(in=in1) lk (rename=(type=_type));&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if in1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _type in (1,2) then type=5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if _type ^= 3 then type=.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else type=3;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 18:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179597#M45818</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-12-20T18:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a value in the data step with same variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179598#M45819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have used type instead of id in the if condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data test1;&lt;BR /&gt; merge test(in=in1) lk;&lt;BR /&gt; by id;&lt;BR /&gt;if in1;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; if id in (1,2) then type=5;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; else if id ^= 3 then type=.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=test1; tables&amp;nbsp; type/list missing; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please used the above code to get the desired result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 18:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179598#M45819</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-12-20T18:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Modify a value in the data step with same variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179599#M45820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&amp;nbsp; It should be the reason.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Dec 2013 20:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Modify-a-value-in-the-data-step-with-same-variable-name/m-p/179599#M45820</guid>
      <dc:creator>Ying</dc:creator>
      <dc:date>2013-12-20T20:09:19Z</dc:date>
    </item>
  </channel>
</rss>

