<?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 unique date of service column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464897#M285048</link>
    <description>&lt;P&gt;Thanks Reeza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thats exactly what I am trying to do. I will close this out and start a new one. Thanks for all your help.&lt;/P&gt;</description>
    <pubDate>Thu, 24 May 2018 20:22:47 GMT</pubDate>
    <dc:creator>wheddingsjr</dc:creator>
    <dc:date>2018-05-24T20:22:47Z</dc:date>
    <item>
      <title>Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/463863#M285026</link>
      <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run a SAS query and when I get the data set I export it to excel and manually manipulate the data. I also&amp;nbsp;use&amp;nbsp;formulas to create new columns in the dataset. I was hoping someone would be able to help me do that within my SAS query if its possible that it can be done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the attached spreadsheet, there are two columns (light colored headings), that I add to the other two columns. The UNIQ DOS column was created by using the excel formula &lt;STRONG&gt;=IF(D1=D2,0,1).&amp;nbsp; &lt;/STRONG&gt;It shows when the BEGDATE changes within the same MEMNO grouping. If its the same date as the date above it within the same MEMNO grouping it populates the cell with a 0, if the BEGDATE changes within the same MEMNO grouping it&amp;nbsp;populates the cell with&amp;nbsp;a 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column labeled DATE COUNT does a cumulative count of all the 1's within the MEMNO grouping. That number is ascertained using the excel formula &lt;STRONG&gt;=COUNTIF($A$2:A2,A2). &lt;/STRONG&gt;Can these formulas and data manipulations be done within the SAS query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 19:28:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/463863#M285026</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-21T19:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/463870#M285027</link>
      <description>&lt;P&gt;By the way, before I use the DATE COUNT formula, I remove all the rows that have a 0 in the UNIQ DOS column then add them back agter I get the DATE COUNT&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 20:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/463870#M285027</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-21T20:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/463908#M285028</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114971"&gt;@wheddingsjr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can these formulas and data manipulations be done within the SAS query?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, those can be accomplished in several different ways, but you need to think about it differently. Specifically, SAS has BY group processing that distinguishes blocks of data from each other if your groups are clearly defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You basically want this type of logic to identify your first of each date, but depending on what you're doing with that, maybe you don't want it at all, since the data step has automatic variables that do that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This tutorials walks through how to create the enumeration values and the last example uses two variables, which in your case is the ID and date. You likely need to program for this, I'm not aware of a task or GUI that will accomplish this in either SAS Studio or EG.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have trouble post your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 21:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/463908#M285028</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-21T21:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464059#M285029</link>
      <description>&lt;P&gt;Hi Reeza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for responding. I looked at the tutorial and if I understand it correctly, I think the example would definitely work for the DATE COUNT column. However, before doing so, I still need a way to populate the UNIQ DOS column to determine if the row should contain a 1 or a zero in that column because I want to exclude those rows with 0 when I do the count. In my initial post I neglected to include that but subsequently appended the post. The UNIQ DOS column shows when the BEGDATE changes within the same MEMNO grouping. If it’s the same date as the date above it within the same MEMNO grouping it populates the cell with a 0, if the BEGDATE changes within the same MEMNO grouping it populates the cell with a 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 14:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464059#M285029</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T14:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464101#M285030</link>
      <description>&lt;P&gt;That would be the FIRST.DATE value, which you could store in your variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;unique_dos = first.date;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114971"&gt;@wheddingsjr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for responding. I looked at the tutorial and if I understand it correctly, I think the example would definitely work for the DATE COUNT column. However, before doing so, I still need a way to populate the UNIQ DOS column to determine if the row should contain a 1 or a zero in that column because I want to exclude those rows with 0 when I do the count. In my initial post I neglected to include that but subsequently appended the post. The UNIQ DOS column shows when the BEGDATE changes within the same MEMNO grouping. If it’s the same date as the date above it within the same MEMNO grouping it populates the cell with a 0, if the BEGDATE changes within the same MEMNO grouping it populates the cell with a 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 15:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464101#M285030</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T15:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464149#M285031</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="2"&gt;Before I was aware you responded, I was experimenting with one of the examples in the tutorial and used the following after creating a new column called combo which combines the MEMNO and the BEGDATE and used:&lt;/FONT&gt;&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; Results1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Results;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;count + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; combo;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; first.combo &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; UNIQDOS = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="lucida sans unicode,lucida sans" size="2"&gt;I was pleasantly suprised that the results came out with the UNIQ DOS correctly but the count was a continuos count and did not restart at the new MEMNO (see attached).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 19:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464149#M285031</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T19:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464160#M285032</link>
      <description>&lt;P&gt;That's because MEMNO is not in your BY statement and you didn't set it to reset at the boundary....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Results1;

set Results;

by memno combo;

if first.memno then count=0; *reset for memno;

count + 1;

UNIQDOS = first.combo;


run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 May 2018 19:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464160#M285032</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T19:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464166#M285033</link>
      <description>&lt;P&gt;That worked perfectly!! Thanks Reeza. Now I have to work on the second stage which is to eliminate all the MEMNO's that have less than a 20 count.&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 19:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464166#M285033</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T19:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464168#M285034</link>
      <description>I take that back..it didnt work perfectly. It should only count the UNIQDOS in the MEMNO grouping not the number of lines within the MEMNO grouping. There are 4 lines in a grouping but only 2 UNIQDOS, etc.</description>
      <pubDate>Tue, 22 May 2018 19:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464168#M285034</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T19:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464173#M285035</link>
      <description>&lt;P&gt;Show the exact code you ran and the unexpected output please.&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 19:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464173#M285035</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T19:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464174#M285036</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table demo as

select memno, count(distinct combo) as unique_dates

from have

group by memno;

quit;



proc sql;

create table demo as

select memno, count(distinct combo) as unique_dates

from have

group by memno

having calculated unique_dates&amp;gt; 20;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those are some ways to get the list of records that are over 20&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can then exclude them using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from have where memno  not in (select memno from demo);&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 20:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464174#M285036</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T20:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464181#M285037</link>
      <description>&lt;P&gt;This is the code I ran and I attached an excel file&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; Results1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Results;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; memno combo;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; first.memno &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; count=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;count + &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;UNIQDOS = first.combo;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 20:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464181#M285037</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T20:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464182#M285038</link>
      <description>The attached on the above post is the desired outcome</description>
      <pubDate>Tue, 22 May 2018 20:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464182#M285038</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T20:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464184#M285039</link>
      <description>&lt;P&gt;So exactly what is different? I'm not seeing what's wrong with the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT:&lt;/P&gt;
&lt;P&gt;Remember that many users, myself included, do not download excel files. I can view the preview but not download the files. So if you post data we can work with that helps, and Excel files are not workable. So the solutions provided are untested unless you provide sample data as a data step.&lt;/P&gt;
&lt;P&gt;Instructions on how to provide sample data is here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 20:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464184#M285039</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T20:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464189#M285040</link>
      <description>&lt;P&gt;I will try to post it on here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;MEMNO&lt;/STRONG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;TD&gt;01/08/18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6789&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;01/08/18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7890&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;03/22/18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7890&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;03/22/18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7890&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;04/11/18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7890&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;04/11/18&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 22 May 2018 20:45:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464189#M285040</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T20:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464191#M285041</link>
      <description>&lt;P&gt;So the duplicates in the COUNT is what you don't want?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That seems weird and inconsistent with most other uses.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would have to create a temporary variable and use the FIRST logic to assign the variable only at the start. But you'd have to keep the temporary variable as well.&amp;nbsp; Basically, exactly what you have but add a new variable and that is the same but only assigned when it's the first for each date, or uniquedos=1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you could process it after the fact to set it to missing whenever uniquedos=0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 20:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464191#M285041</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T20:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464196#M285042</link>
      <description>&lt;P&gt;That is correct. I am trying to tally all of the unique dates of service per MEMNO, NOT the total amount of lines per MEMNO&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 21:02:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464196#M285042</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-22T21:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464198#M285043</link>
      <description>&lt;P&gt;The counts are still correct, just duplicated for duplicates.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is just for presentation by the way, using PROC REPORT or PRINT with a GROUP should prevent it from being duplicated.&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 21:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464198#M285043</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-22T21:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464555#M285044</link>
      <description>&lt;P&gt;Reeza&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to do everything I wanted to do with this and it came out perfect. I definately appreciate the help and what was once a 3-4 hour manual adventure (not counting an additional step that I will try to figure out), has now been reduced to 20 mins. so far. Next step is comparing my outcome to the previous month. I am going to search the net to see if there is a way to import documents into my SAS program.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 19:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464555#M285044</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2018-05-23T19:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a unique date of service column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464626#M285045</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114971"&gt;@wheddingsjr&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;Next step is comparing my outcome to the previous month. I am going to search the net to see if there is a way to import documents into my SAS program.&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Going forward consider to do ALL your calculations in SAS and then store the monthly data in a monthly permanent table. This way your source of truth will be the managed tables and you won't have to deal with importing some external documents/Excels over which you eventually don't have full control. ...and if you keep these monthly tables then you're always able to fully reproduce results at a later stage and of course can simply compare the data in different monthly tables to create movement reports or for whatever reasons you have to compare the months.&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 03:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-unique-date-of-service-column/m-p/464626#M285045</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-05-24T03:16:49Z</dc:date>
    </item>
  </channel>
</rss>

