<?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: Creating a new column in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707476#M26512</link>
    <description>&lt;P&gt;I edited my post. I meant output, of course.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Dec 2020 14:30:10 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-12-21T14:30:10Z</dc:date>
    <item>
      <title>Creating a new column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707237#M26473</link>
      <description>&lt;PRE&gt;Actually, I want to create a new column name h_67 which will be equal one if the column/variable avg_percent_moneyness &amp;gt;=.67 twice within the sample period otherwise it will be zero. Here, in the code count function is not working as is it not correct. I need help in this regard, hope I will get the reply from you.&lt;BR /&gt;I tried the following code but it does not work. Variable holder in the data, is equal 1 if avg_percent_moneyness&amp;gt;= .67 or remains o&lt;/PRE&gt;&lt;PRE&gt;Data want;
set have;
If (count(avg_percent_moneyness&amp;gt;=.67))&amp;gt;=2 then holder_67=1;
else 0;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 03:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707237#M26473</guid>
      <dc:creator>Ramin1</dc:creator>
      <dc:date>2020-12-20T03:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707241#M26475</link>
      <description>&lt;P&gt;Assuming that &lt;EM&gt;by sampling period&lt;/EM&gt; you mean by gvkey (?), you could use two &lt;STRONG&gt;do until()&lt;/STRONG&gt; loops:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
count = 0;
do until (last.gvkey);
    set sasforum.t; by gvkey;
    if avg_percent_moneyness &amp;gt;= 0.67 then count + 1;
    end;
h_67 = count &amp;gt;= 2;
do until (last.gvkey);
    set sasforum.t; by gvkey;
    output;
    end;
drop count;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Dec 2020 14:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707241#M26475</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-12-21T14:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707367#M26497</link>
      <description>Thanks a lot for your quick reply, PGStats. Sampling period means, I have 20 years of data and if the executive scored more than .67 in avg_percent_moneyness twice within that sample year then h_67 will be 1 for that person else 0. I forget to give you one more column in the data that is the ID for each executive and I use by executive id in the do until loop.&lt;BR /&gt;In the second do until loop, is it outout or it should be output? When I code outout SAS corrected it as output.</description>
      <pubDate>Mon, 21 Dec 2020 06:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707367#M26497</guid>
      <dc:creator>Ramin1</dc:creator>
      <dc:date>2020-12-21T06:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707476#M26512</link>
      <description>&lt;P&gt;I edited my post. I meant output, of course.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 14:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Creating-a-new-column/m-p/707476#M26512</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-12-21T14:30:10Z</dc:date>
    </item>
  </channel>
</rss>

