<?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 add a column just in one procedure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286283#M58682</link>
    <description>&lt;P&gt;Are you looking for something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; aa;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; z = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Y"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; K = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Y"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; k = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"N"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2016 21:39:52 GMT</pubDate>
    <dc:creator>PBsas</dc:creator>
    <dc:date>2016-07-21T21:39:52Z</dc:date>
    <item>
      <title>how to add a column just in one procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286272#M58678</link>
      <description>&lt;P&gt;Data aa;&lt;BR /&gt; input X$ Z $;&lt;BR /&gt; datalines;&lt;BR /&gt; eliy N&lt;BR /&gt; eliya Y&lt;BR /&gt; ais N&lt;BR /&gt; shsi N&lt;BR /&gt; ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to add a column ‘K’. If column'Z' contains Y, then all values in column 'K' are Y, else are N.&lt;/P&gt;
&lt;P&gt;Who could tell me ....if I could do this in just one data step or one proc sql?I don't hope to first get a dataset then merge or join.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 20:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286272#M58678</guid>
      <dc:creator>cecily</dc:creator>
      <dc:date>2016-07-21T20:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a column just in one procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286277#M58680</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Not tested :&lt;BR /&gt;Proc sql;&lt;BR /&gt;CREATE TABLE want AS&lt;BR /&gt;SELECT a.*, b.K&lt;BR /&gt;FROM aa AS a&lt;BR /&gt;LEFT JOIN (&lt;BR /&gt;SELECT CASE WHEN SUM(Z="Y") THEN "Y" ELSE "N"&lt;BR /&gt;END AS K&lt;BR /&gt;FROM aa&lt;BR /&gt;) AS b&lt;BR /&gt;ON 1;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 21:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286277#M58680</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2016-07-21T21:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a column just in one procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286283#M58682</link>
      <description>&lt;P&gt;Are you looking for something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; aa;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; z = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Y"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; K = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Y"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;else&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; k = &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"N"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 21:39:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286283#M58682</guid>
      <dc:creator>PBsas</dc:creator>
      <dc:date>2016-07-21T21:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a column just in one procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286292#M58689</link>
      <description>&lt;P&gt;oh!!This is what I want! Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 22:42:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286292#M58689</guid>
      <dc:creator>cecily</dc:creator>
      <dc:date>2016-07-21T22:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a column just in one procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286293#M58690</link>
      <description>&lt;P&gt;No. what I want is all values for that new column are ‘Y’ if column 'Z' contains 'Y'. &amp;nbsp;I have got the right answer. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 22:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286293#M58690</guid>
      <dc:creator>cecily</dc:creator>
      <dc:date>2016-07-21T22:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a column just in one procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286348#M58711</link>
      <description>&lt;P&gt;Or to simplfy:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  *,
          case when exists(select distinct Z from AA where Z="Y") then "Y"
               else "N" end as K
  from    AA;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, saying that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  *,
          coalesce((select distinct Z from AA where Z="Y"),"N") as K
  from    AA;
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2016 09:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-column-just-in-one-procedure/m-p/286348#M58711</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-22T09:40:36Z</dc:date>
    </item>
  </channel>
</rss>

