<?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 want to output Y if observations variable x equals to something in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326323#M72651</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to output "Y" if FIN_CD equals "1S".&amp;nbsp;If there's any other variable other than 1S then&amp;nbsp;I&amp;nbsp;do not want to output them.&amp;nbsp;I'm not sure if I'm able to do this in the WHERE statement or if I need a data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;&lt;BR /&gt;create table automation_exception as&lt;BR /&gt;&lt;BR /&gt;SELECT&lt;STRONG&gt;  &lt;BR /&gt;  TRANSACTION_FACT.TRN_CD as FIN_CD,&lt;/STRONG&gt;
       
FROM
    RDWP0.TRANSACTION_FACT,
    RDWP0.TRANSACTION_CD_LOOKUP,

WHERE
    (TRANSACTION_CD_LOOKUP.TRN_CD=TRANSACTION_FACT.TRN_CD)
    AND (ACCT_DIM.ACCT_ID=TRANSACTION_FACT.ACCT_ID);&lt;BR /&gt;&lt;BR /&gt;QUIT;
    &lt;/PRE&gt;</description>
    <pubDate>Fri, 20 Jan 2017 15:58:48 GMT</pubDate>
    <dc:creator>jmoore168</dc:creator>
    <dc:date>2017-01-20T15:58:48Z</dc:date>
    <item>
      <title>want to output Y if observations variable x equals to something</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326323#M72651</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to output "Y" if FIN_CD equals "1S".&amp;nbsp;If there's any other variable other than 1S then&amp;nbsp;I&amp;nbsp;do not want to output them.&amp;nbsp;I'm not sure if I'm able to do this in the WHERE statement or if I need a data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL;&lt;BR /&gt;create table automation_exception as&lt;BR /&gt;&lt;BR /&gt;SELECT&lt;STRONG&gt;  &lt;BR /&gt;  TRANSACTION_FACT.TRN_CD as FIN_CD,&lt;/STRONG&gt;
       
FROM
    RDWP0.TRANSACTION_FACT,
    RDWP0.TRANSACTION_CD_LOOKUP,

WHERE
    (TRANSACTION_CD_LOOKUP.TRN_CD=TRANSACTION_FACT.TRN_CD)
    AND (ACCT_DIM.ACCT_ID=TRANSACTION_FACT.ACCT_ID);&lt;BR /&gt;&lt;BR /&gt;QUIT;
    &lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326323#M72651</guid>
      <dc:creator>jmoore168</dc:creator>
      <dc:date>2017-01-20T15:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: want to output Y if observations variable x equals to something</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326328#M72654</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123022"&gt;@jmoore168&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to output "Y" if FIN_CD equals "1S".&amp;nbsp;If there's any other variable other than 1S then&amp;nbsp;I&amp;nbsp;do not want to output them.&amp;nbsp;I'm not sure if I'm able to do this in the WHERE statement or if I need a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you mean if FIN_CD is not equal to '1S' you don't want them in the output at all? If so subset the data as early as practical:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FROM&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;select&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; * &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;from&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; RDWP0.TRANSACTION_FACT &lt;/FONT&gt;&lt;FONT color="#0000ff" face="SAS Monospace" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt; TRN_CD = &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'1S'&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;) ,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;RDWP0.TRANSACTION_CD_LOOKUP,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;will only select the records of interest before combining with the other data set.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 16:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326328#M72654</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-20T16:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: want to output Y if observations variable x equals to something</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326697#M72812</link>
      <description>Hi Ballardw&lt;BR /&gt;&lt;BR /&gt;Your solution worked perfectly. However I may have been mistaken with regard to how I want to handle other FIN_CD's separately from 1S. For example if FIN_CD output's anything other than '1S' then I want it to output blank or 'N'. This blank tells us we need to take a specific action. 1S means we have already did it. Basically this is an exception report. I need to combine the previous code you sugguested in addition to what I'm asking here.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Mon, 23 Jan 2017 12:42:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326697#M72812</guid>
      <dc:creator>jmoore168</dc:creator>
      <dc:date>2017-01-23T12:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: want to output Y if observations variable x equals to something</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326713#M72815</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could it be as simple as the following?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
SELECT  
  case when TRANSACTION_FACT.&lt;FONT face="SAS Monospace" size="2"&gt;TRN_CD eq &lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2" color="#800080"&gt;'1S' then '1S' else &lt;/FONT&gt;'N' end as FIN_CD,
       
  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 14:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-output-Y-if-observations-variable-x-equals-to-something/m-p/326713#M72815</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-23T14:21:39Z</dc:date>
    </item>
  </channel>
</rss>

