<?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: a=(b=&amp;quot;text&amp;quot;) not able to understand this code in sas dataseetp in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881061#M348149</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/345485"&gt;@veeresh10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have program like this&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;DATA TEST;&lt;BR /&gt;SET TEST;&lt;BR /&gt;REGID1=(REGNUM)="BLR");&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;I not able to understand this code what is happening here. Need quick help.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That particular code shown will do nothing except throw an error about mismatched parentheses.&lt;/P&gt;
&lt;P&gt;If the code were like in your question subject line as below:&lt;/P&gt;
&lt;PRE&gt;DATA TEST;
SET TEST;
REGID1=(REGNUM="BLR");
RUN;&lt;/PRE&gt;
&lt;P&gt;Then the intent would likely be that the variable Regid1 to be assigned a numeric value of 1 when the variable Regnum="BLR" and 0 otherwise. I say intent because that might be affected by the presence of the variable Regid1 if it is already in the the data set Test. SAS will return a numeric 1 for any logic comparison that is true and 0 when it is false.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suggestion: When you have questions about how code behaves run the code. If you don't understand then copy from the LOG the data step or procedure code with all notes, warnings and errors. Then on the forum open a text box using the &amp;lt;/&amp;gt; icon and paste all the next.&lt;/P&gt;
&lt;P&gt;The log would be helpful because it would have shown the error generated by your posted code. If the code runs then there might be messages about 'conversion of numeric to text' which might happen if the varaible Regid1 already exists on the data set test and is a character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warning: Habitual use of code with the same data set on the Data and Set statements like below completely replaces the original Test data set. For new programmers this is likely to result in questions about "why is this value/variable/observartion&amp;nbsp; here or missing as logic errors but not syntax errors execute. While learning basic code I &lt;STRONG&gt;strongly&lt;/STRONG&gt; recommend always creating an different output data set so you can see the differences between the input and output data (Hint: there is a procedure called COMPARE to actually do that task)&lt;/P&gt;
&lt;PRE&gt;data test;
   set test;
/* other code*/
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Jun 2023 08:39:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-06-16T08:39:17Z</dc:date>
    <item>
      <title>a=(b="text") not able to understand this code in sas dataseetp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881060#M348148</link>
      <description>&lt;P&gt;I have program like this&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;DATA TEST;&lt;BR /&gt;SET TEST;&lt;BR /&gt;REGID1=(REGNUM)="BLR");&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;I not able to understand this code what is happening here. Need quick help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 08:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881060#M348148</guid>
      <dc:creator>veeresh10</dc:creator>
      <dc:date>2023-06-16T08:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: a=(b="text") not able to understand this code in sas dataseetp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881061#M348149</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/345485"&gt;@veeresh10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have program like this&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;DATA TEST;&lt;BR /&gt;SET TEST;&lt;BR /&gt;REGID1=(REGNUM)="BLR");&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;I not able to understand this code what is happening here. Need quick help.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That particular code shown will do nothing except throw an error about mismatched parentheses.&lt;/P&gt;
&lt;P&gt;If the code were like in your question subject line as below:&lt;/P&gt;
&lt;PRE&gt;DATA TEST;
SET TEST;
REGID1=(REGNUM="BLR");
RUN;&lt;/PRE&gt;
&lt;P&gt;Then the intent would likely be that the variable Regid1 to be assigned a numeric value of 1 when the variable Regnum="BLR" and 0 otherwise. I say intent because that might be affected by the presence of the variable Regid1 if it is already in the the data set Test. SAS will return a numeric 1 for any logic comparison that is true and 0 when it is false.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suggestion: When you have questions about how code behaves run the code. If you don't understand then copy from the LOG the data step or procedure code with all notes, warnings and errors. Then on the forum open a text box using the &amp;lt;/&amp;gt; icon and paste all the next.&lt;/P&gt;
&lt;P&gt;The log would be helpful because it would have shown the error generated by your posted code. If the code runs then there might be messages about 'conversion of numeric to text' which might happen if the varaible Regid1 already exists on the data set test and is a character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warning: Habitual use of code with the same data set on the Data and Set statements like below completely replaces the original Test data set. For new programmers this is likely to result in questions about "why is this value/variable/observartion&amp;nbsp; here or missing as logic errors but not syntax errors execute. While learning basic code I &lt;STRONG&gt;strongly&lt;/STRONG&gt; recommend always creating an different output data set so you can see the differences between the input and output data (Hint: there is a procedure called COMPARE to actually do that task)&lt;/P&gt;
&lt;PRE&gt;data test;
   set test;
/* other code*/
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2023 08:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881061#M348149</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-16T08:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: a=(b="text") not able to understand this code in sas dataseetp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881062#M348150</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/345485"&gt;@veeresh10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have program like this&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;DATA TEST;&lt;BR /&gt;SET TEST;&lt;BR /&gt;REGID1=(REGNUM)="BLR");&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;I not able to understand this code what is happening here. Need quick help.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As posted, the code will only result in a syntax ERROR (one opening bracket, but two closing brackets).&lt;/P&gt;
&lt;P&gt;But if that line is actually&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;REGID1=(REGNUM="BLR");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then the comparison REGNUM="BLR" is evaluated, and the (boolean) result stored in REGID1.&lt;/P&gt;
&lt;P&gt;The code is equivalent to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if regnum = "BLR"
then regid1 = 1;
else regid1 = 0;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2023 08:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-b-quot-text-quot-not-able-to-understand-this-code-in-sas/m-p/881062#M348150</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-16T08:41:00Z</dc:date>
    </item>
  </channel>
</rss>

