<?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: 'Call to Count'  Warning in DATA step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24784#M4245</link>
    <description>Thanks Ike. I have  a few questions:&lt;BR /&gt;
&lt;BR /&gt;
What is an example of a character-value?&lt;BR /&gt;
What is a string?&lt;BR /&gt;
What is a modifier?&lt;BR /&gt;
Can you explain the boolean idea more indepth?&lt;BR /&gt;
&lt;BR /&gt;
Example of Data:&lt;BR /&gt;
&lt;BR /&gt;
num     personum&lt;BR /&gt;
A01     1&lt;BR /&gt;
A01     2&lt;BR /&gt;
A01     3&lt;BR /&gt;
A01     4&lt;BR /&gt;
A02     1&lt;BR /&gt;
A02     2&lt;BR /&gt;
A02    3&lt;BR /&gt;
A02     4&lt;BR /&gt;
A03    1&lt;BR /&gt;
A03    2&lt;BR /&gt;
A03    3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to find two of the same observations entered, or duplicates.&lt;BR /&gt;
(EX:  if there are two A01's with the same personum).&lt;BR /&gt;
I undestand that the idea that two observations fields num and personum are combined. But how is a duplicate actually identified?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
    <pubDate>Wed, 11 Jun 2008 21:30:26 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-06-11T21:30:26Z</dc:date>
    <item>
      <title>'Call to Count'  Warning in DATA step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24782#M4243</link>
      <description>1) Why is SAS giving a warning?  What's wrong?  Thanks!&lt;BR /&gt;
2) Can you explain the following lines? What does first.child mean or do?&lt;BR /&gt;
    if first.person then duplicate=0;&lt;BR /&gt;
    else duplicate=count(person, num, personum);&lt;BR /&gt;
&lt;BR /&gt;
num is a character variable and has the following values: A01, A02, A03 ,etc&lt;BR /&gt;
personum is a character variable and has the following values:  1,2,3,4,,5, etc&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
&lt;BR /&gt;
CODE:&lt;BR /&gt;
&lt;BR /&gt;
data err;&lt;BR /&gt;
  set err;&lt;BR /&gt;
  person=num||personum;&lt;BR /&gt;
  keep num personum person;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
4567  data err;&lt;BR /&gt;
4568    set err;&lt;BR /&gt;
4569    by person;&lt;BR /&gt;
4570    if first.person then duplicate=0;&lt;BR /&gt;
4571    else duplicate=count(person, num, personum);&lt;BR /&gt;
4572  run;&lt;BR /&gt;
&lt;BR /&gt;
WARNING: In a call to the COUNT function or routine, the modifier "7" not valid&lt;BR /&gt;
WARNING: In a call to the COUNT function or routine, the modifier "5 not valid.&lt;BR /&gt;
WARNING: In a call to the COUNT function or routine, the modifier "7" not valid.&lt;BR /&gt;
WARNING: In a call to the COUNT function or routine, the modifier "5" not valid.&lt;BR /&gt;
WARNING: In a call to the COUNT function or routine, the modifier "7" not valid.

corrected errors&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: jcis</description>
      <pubDate>Wed, 11 Jun 2008 17:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24782#M4243</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-11T17:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: 'Call to Count'  Warning in DATA step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24783#M4244</link>
      <description>Part 1)&lt;BR /&gt;
&lt;BR /&gt;
Well the syntax for COUNT is&lt;BR /&gt;
&lt;BR /&gt;
COUNT(character-value,find-string&amp;lt;,'modifiers'&amp;gt;)&lt;BR /&gt;
&lt;BR /&gt;
The only allowable modifiers are i,I,t,T&lt;BR /&gt;
&lt;BR /&gt;
So your function call is sending the numbers 1-7 to the call , which is improper syntax.&lt;BR /&gt;
&lt;BR /&gt;
Can't help you fix it unless you give us an idea of what it is supposed to do&lt;BR /&gt;
&lt;BR /&gt;
Part 2)&lt;BR /&gt;
&lt;BR /&gt;
first.child is a boolean&lt;BR /&gt;
=1 if the current observation is the first one in the group formed by the BY variable (in this case child), and 0 otherwise.&lt;BR /&gt;
&lt;BR /&gt;
Ike</description>
      <pubDate>Wed, 11 Jun 2008 20:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24783#M4244</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-11T20:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: 'Call to Count'  Warning in DATA step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24784#M4245</link>
      <description>Thanks Ike. I have  a few questions:&lt;BR /&gt;
&lt;BR /&gt;
What is an example of a character-value?&lt;BR /&gt;
What is a string?&lt;BR /&gt;
What is a modifier?&lt;BR /&gt;
Can you explain the boolean idea more indepth?&lt;BR /&gt;
&lt;BR /&gt;
Example of Data:&lt;BR /&gt;
&lt;BR /&gt;
num     personum&lt;BR /&gt;
A01     1&lt;BR /&gt;
A01     2&lt;BR /&gt;
A01     3&lt;BR /&gt;
A01     4&lt;BR /&gt;
A02     1&lt;BR /&gt;
A02     2&lt;BR /&gt;
A02    3&lt;BR /&gt;
A02     4&lt;BR /&gt;
A03    1&lt;BR /&gt;
A03    2&lt;BR /&gt;
A03    3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to find two of the same observations entered, or duplicates.&lt;BR /&gt;
(EX:  if there are two A01's with the same personum).&lt;BR /&gt;
I undestand that the idea that two observations fields num and personum are combined. But how is a duplicate actually identified?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Wed, 11 Jun 2008 21:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24784#M4245</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-11T21:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: 'Call to Count'  Warning in DATA step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24785#M4246</link>
      <description>1) As to your queries about the syntax of COUNT function, refer to the following link:&lt;BR /&gt;
&lt;A href="http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a002260230.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a002260230.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
2) Boolean concept: When data is sorted on a particular variable (BY variable) in sas dataset, you can reference the first or last elements of the group by referencing them through first.variable and last.variable syntax.&lt;BR /&gt;
&lt;BR /&gt;
For example let us take a part of ur dataset:&lt;BR /&gt;
&lt;BR /&gt;
num personum&lt;BR /&gt;
A01 1------------------ first.num&lt;BR /&gt;
A01 2&lt;BR /&gt;
A01 3&lt;BR /&gt;
A01 4------------------ last.num&lt;BR /&gt;
A02 1------------------ first.num&lt;BR /&gt;
A02 2&lt;BR /&gt;
A02 3&lt;BR /&gt;
A02 4------------------ last.num&lt;BR /&gt;
&lt;BR /&gt;
 If you want to remove duplicates you can use PROC SORT with NODUPKEY.&lt;BR /&gt;
&lt;BR /&gt;
But if you want to count duplicates you have to put your own logic. COUNT procedure does not do what you want, it will count the number of times that a specific substring of characters appears within a character string that you specify.&lt;BR /&gt;
&lt;BR /&gt;
A sample logic that will do what you want might be:&lt;BR /&gt;
I take that your dataset is already sorted BY num personum&lt;BR /&gt;
&lt;BR /&gt;
 &lt;I&gt;data temp;&lt;BR /&gt;
set err;&lt;BR /&gt;
person=num||personum;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort; by person; run; (this might be redundant but still)&lt;BR /&gt;
&lt;BR /&gt;
data temp;&lt;BR /&gt;
set temp; by personum;&lt;BR /&gt;
cnt=0;&lt;BR /&gt;
if not first.personum then cnt = cnt + 1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
The dataset temp will have a new variable "cnt" which will have the number of duplicate ocurrences of a particular combination num and personum.&lt;BR /&gt;
&lt;BR /&gt;
A better way to do it might be:&lt;BR /&gt;
&lt;I&gt;data temp;&lt;BR /&gt;
set err; by num personum;&lt;BR /&gt;
cnt=0;&lt;BR /&gt;
if first.num and not (first.personum) then cnt = cnt + 1; &lt;BR /&gt;
&lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps.</description>
      <pubDate>Thu, 12 Jun 2008 09:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24785#M4246</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-12T09:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: 'Call to Count'  Warning in DATA step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24786#M4247</link>
      <description>Thanks for the link to the Call to Count function. And, thanks also fore the explanation of a Boolean. I'm looking into the SAS program a little more. Thanks!</description>
      <pubDate>Fri, 13 Jun 2008 22:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-to-Count-Warning-in-DATA-step/m-p/24786#M4247</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-13T22:07:27Z</dc:date>
    </item>
  </channel>
</rss>

