<?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 Count Number of Entries present rowise in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876365#M38884</link>
    <description>&lt;P&gt;I have a prepared data which have VPA(Virtual Payment Address), and and Number of transactions they have made datewise from 1 APRIL, 2023 till 30APRIL2023. Something like the below Screenshot.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kirito1_0-1684388604329.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84074iFB39BD3C33ACE689/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kirito1_0-1684388604329.png" alt="Kirito1_0-1684388604329.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I want to count number of days that VPA was active. I want to introduce a new column which contains number of days they active and that count should be stored in a new column.&lt;/P&gt;
&lt;P&gt;Thanks in Advance for all the contributors&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 May 2023 05:46:16 GMT</pubDate>
    <dc:creator>Kirito1</dc:creator>
    <dc:date>2023-05-18T05:46:16Z</dc:date>
    <item>
      <title>Count Number of Entries present rowise</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876365#M38884</link>
      <description>&lt;P&gt;I have a prepared data which have VPA(Virtual Payment Address), and and Number of transactions they have made datewise from 1 APRIL, 2023 till 30APRIL2023. Something like the below Screenshot.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kirito1_0-1684388604329.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84074iFB39BD3C33ACE689/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kirito1_0-1684388604329.png" alt="Kirito1_0-1684388604329.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I want to count number of days that VPA was active. I want to introduce a new column which contains number of days they active and that count should be stored in a new column.&lt;/P&gt;
&lt;P&gt;Thanks in Advance for all the contributors&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 05:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876365#M38884</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-05-18T05:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count Number of Entries present rowise</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876368#M38885</link>
      <description>&lt;P&gt;Post your example data as a DATA step with DATALINES, not as a picture which we can't insert in our SAS program editors.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 06:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876368#M38885</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-18T06:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count Number of Entries present rowise</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876404#M38897</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I want to count number of days that VPA was active.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What does "VPA was active" mean? How would we determine this from the data?&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 10:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876404#M38897</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-18T10:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Count Number of Entries present rowise</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876408#M38899</link>
      <description>&lt;P&gt;1) The form of table you have is a textbook example of "bad data practice". If I were you I would keep your data in "long" form:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input VPA $  date date9. value;
format date date9.;
cards;
ABC1 1apr2023 .
ABC1 2apr2023 2
ABC1 3apr2023 3
ABC1 4apr2023 .
ABC1 5apr2023 5
ABC2 1apr2023 .
ABC2 2apr2023 .
ABC2 3apr2023 3
ABC2 4apr2023 4
ABC2 5apr2023 .
ABC3 1apr2023 1
ABC3 2apr2023 .
ABC3 3apr2023 .
ABC3 4apr2023 4
ABC3 5apr2023 5
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with such "structure-less" data you could do the calculation like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1;
  set have;
  where value;
  by VPA;

  Number_of_days + 1;

  if last.VPA then
    do;
      output;
      Number_of_days = 0;
    end;
  keep VPA Number_of_days;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) But since you have data in this "bad" format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=ANY;
proc transpose data=have out=have_BAD(drop=_name_);
  by VPA;
  id date;
  var value;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you could do it like this using variables arrays:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
  set have_BAD;
  array d '1apr2023'n--'5apr2023'n;

  do over d;
    Number_of_days + d&amp;gt;.z;
  end;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;[EDIT:]&lt;/P&gt;
&lt;P&gt;P.S. Just to be clear variable arrays are very practical and useful tools. And it is "good programming practice" to learn how to work with them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 10:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-Number-of-Entries-present-rowise/m-p/876408#M38899</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-05-18T10:42:29Z</dc:date>
    </item>
  </channel>
</rss>

