<?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 use sub-query result to create new field and set value? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301355#M63751</link>
    <description>&lt;P&gt;Hi JediApprentice,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the below suggestion! &amp;nbsp;The logic worked the way you have it. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of condition&amp;nbsp;WHERE D2.DSDECODED ="TREATMENT UNBLINDED", if I have it, the code works to only set "YES" for the "DECODE" Flag, if&lt;FONT face="monospace"&gt;&amp;nbsp;removed,&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;it evaluates to more than one row, breaking the code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2016 17:16:41 GMT</pubDate>
    <dc:creator>zz</dc:creator>
    <dc:date>2016-09-28T17:16:41Z</dc:date>
    <item>
      <title>How to use sub-query result to create new field and set value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301280#M63722</link>
      <description>&lt;P&gt;I have a sub-query as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(SELECT D2.DSDECODED FROM DS_02 D2 WHERE D2.DSDECODED ="TREATMENT UNBLINDED" AND D.USUBJID=D2.USUBJID) AS DECODE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I program so, instead of DECODE taking the value of D2.DSDECODED(TREATMENT UNBLINDED), it now takes the value of either "YES", when&amp;nbsp;&lt;SPAN&gt;D2.DSDECODED ="TREATMENT UNBLINDED", or &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"NO", when&amp;nbsp;D2.DSDECODED ="TREATMENT UNBLINDED" is false&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you in advance for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 13:51:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301280#M63722</guid>
      <dc:creator>zz</dc:creator>
      <dc:date>2016-09-28T13:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sub-query result to create new field and set value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301309#M63728</link>
      <description>&lt;P&gt;Maybe you could use a CASE statement? Although I'm not sure why you have &lt;SPAN&gt;WHERE D2.DSDECODED ="TREATMENT UNBLINDED". Don't you want to include records that aren't DSDECODED="TREATMENT UNBLINDED". In that case you could do something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(SELECT 
  (CASE
    WHEN D2.DSDECODED="TREATMENT UNBLINDED" THEN "YES"
    ELSE "NO"
  END) AS DECODE
FROM DS_02 D2 WHERE D.USUBJID=D2.USUBJID)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 15:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301309#M63728</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2016-09-28T15:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sub-query result to create new field and set value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301355#M63751</link>
      <description>&lt;P&gt;Hi JediApprentice,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the below suggestion! &amp;nbsp;The logic worked the way you have it. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of condition&amp;nbsp;WHERE D2.DSDECODED ="TREATMENT UNBLINDED", if I have it, the code works to only set "YES" for the "DECODE" Flag, if&lt;FONT face="monospace"&gt;&amp;nbsp;removed,&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;it evaluates to more than one row, breaking the code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 17:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-sub-query-result-to-create-new-field-and-set-value/m-p/301355#M63751</guid>
      <dc:creator>zz</dc:creator>
      <dc:date>2016-09-28T17:16:41Z</dc:date>
    </item>
  </channel>
</rss>

