<?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 countif (using first function) comparing data sets; within the same household in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48709#M13183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When was it changed that these types of group by summarizations no longer required a retain statement containing the summarizing variables?&amp;nbsp; I tested both ways and results are the same (using SAS under Unix 9.2).&amp;nbsp; However I remember in previous versions or possible different circumstances where if the retain statement was not used results were incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;data cig.Merged2_bna_law;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET cig.Merged2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by household_id;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; retain npb4w npb4r npb4b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.household_id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4w=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4r=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4b=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;work_date then npb4w+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;restaurant_date then npb4r+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;bar_date then npb4b+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.household_id then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Aug 2011 19:40:21 GMT</pubDate>
    <dc:creator>FriedEgg</dc:creator>
    <dc:date>2011-08-15T19:40:21Z</dc:date>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48700#M13174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dear experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me with the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 Data Sets&lt;/P&gt;&lt;P&gt;1. I have three different kinds of dates in a demographic data set called cig.mergedpanel: work_date, restaurant_date and bar_date.&lt;/P&gt;&lt;P&gt;2. I have a purchase data set called cig.panelsample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count total number of purchases for each householdsin cig.panelsample before each of the three dates: work_date, restaurant_date and bar_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data cig.panelsample_b4law;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SET cig.panelsample;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;by household_id;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;&lt;STRONG&gt;STEP1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if first.household_id then npb4w=0 npb4r=0 npb4b=0;&lt;/P&gt;&lt;P&gt;&lt;EM style="text-decoration: underline;"&gt;&lt;STRONG&gt;STEP2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if cig.panelsample(purchase_date)&amp;lt;cig.mergedpanel(work_date) then npb4w+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if cig.panelsample(purchase_date)&amp;lt;cig.mergedpanel(restaurant_date) then npb4r+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if cig.panelsample(purchase_date)&amp;lt;cig.mergedpanel(bar_date) then npb4b+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This wouldn't work for many reasons that are unknown to me (first time user). One obvious reason is that I have multiple statements after then (&lt;STRONG&gt;STEP1&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;Also, i'm not sure how to make comparisons between two different data sets without merging the two (&lt;STRONG&gt;STEP2&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best,&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 16:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48700#M13174</guid>
      <dc:creator>jkf91</dc:creator>
      <dc:date>2011-08-15T16:45:03Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48701#M13175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to provide more information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The step 1 part is easy to correct.&amp;nbsp; It has to be in the form:&lt;/P&gt;&lt;P&gt; if first.household_id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; npb4w=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; npb4r=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; npb4b=0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, regarding step 2, you probably have to merge the two files together, but one can't show you how without knowing the structure of the two files.&amp;nbsp; Does the mergedpanel file include the same household_id's as the panelsample file or, if not, what does it look like?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 16:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48701#M13175</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-08-15T16:54:00Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48702#M13176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you, sir. same household_id's.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 16:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48702#M13176</guid>
      <dc:creator>jkf91</dc:creator>
      <dc:date>2011-08-15T16:56:04Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48703#M13177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i will merged the two first. could you please answer as if everything is in the same file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each household has &lt;EM&gt;different &lt;/EM&gt;work_date, restaurant_date and bar_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;many thanks,&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 16:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48703#M13177</guid>
      <dc:creator>jkf91</dc:creator>
      <dc:date>2011-08-15T16:59:08Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48704#M13178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you merge the two files together (and that can be separately or in the same datastep), then you would just use code something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if purchase_date&amp;lt;work_date then npb4w+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if purchase_date&amp;lt;restaurant_date then npb4r+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if purchase_date&amp;lt;bar_date then npb4b+1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 17:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48704#M13178</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-08-15T17:07:56Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48705#M13179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've tried the following, but I get 0's for all three variables and all rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data cig.Merged2_bna_law;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SET cig.Merged2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;by household_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if first.household_id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;npb4w=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;npb4r=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;npb4b=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if purchase_date&amp;lt;work_date then npb4w+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if purchase_date&amp;lt;restaurant_date then npb4r+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if purchase_date&amp;lt;bar_date then npb4b+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 17:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48705#M13179</guid>
      <dc:creator>jkf91</dc:creator>
      <dc:date>2011-08-15T17:43:23Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48706#M13180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then, I have to think that your merge didn't create what you think it did.&amp;nbsp; Your code appears to be correct, other than you probably want to add a statement that only outputs the results for the last record for each household.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without seeing the data one can only guess.&amp;nbsp; My first guesses would be that some or all of the dates haven't been read in as SAS dates or that you simply don't have any records that meet the conditions that you specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the following.&amp;nbsp; It appears to be doing what you want to do and the only difference between it and your code is the addition of the suggested output statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data cig.Merged2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat purchase_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; work_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; restaurant_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bar_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input household_id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; purchase_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; work_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; restaurant_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bar_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 10AUG2011 11AUG2011 12AUG2011 10AUG2011&lt;/P&gt;&lt;P&gt;1 09AUG2011 11AUG2011 12AUG2011 10AUG2011&lt;/P&gt;&lt;P&gt;1 15AUG2011 11AUG2011 12AUG2011 10AUG2011&lt;/P&gt;&lt;P&gt;2 06AUG2011 11AUG2011 12AUG2011 10AUG2011&lt;/P&gt;&lt;P&gt;2 09AUG2011 11AUG2011 12AUG2011 10AUG2011&lt;/P&gt;&lt;P&gt;2 08AUG2011 11AUG2011 12AUG2011 10AUG2011&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data cig.Merged2_bna_law;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET cig.Merged2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by household_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.household_id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4w=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4r=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4b=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;work_date then npb4w+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;restaurant_date then npb4r+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;bar_date then npb4b+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.household_id then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 18:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48706#M13180</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-08-15T18:02:22Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48707#M13181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with art297.&amp;nbsp; I tried with simple numbers instead of dates and can see the three variables correctly accumulated within each household.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 18:11:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48707#M13181</guid>
      <dc:creator>gxu</dc:creator>
      <dc:date>2011-08-15T18:11:59Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48708#M13182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you very much, sir! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 18:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48708#M13182</guid>
      <dc:creator>jkf91</dc:creator>
      <dc:date>2011-08-15T18:18:32Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48709#M13183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When was it changed that these types of group by summarizations no longer required a retain statement containing the summarizing variables?&amp;nbsp; I tested both ways and results are the same (using SAS under Unix 9.2).&amp;nbsp; However I remember in previous versions or possible different circumstances where if the retain statement was not used results were incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;data cig.Merged2_bna_law;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET cig.Merged2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by household_id;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; retain npb4w npb4r npb4b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.household_id then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4w=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4r=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npb4b=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;work_date then npb4w+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;restaurant_date then npb4r+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if purchase_date&amp;lt;bar_date then npb4b+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.household_id then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 19:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48709#M13183</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-08-15T19:40:21Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48710#M13184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you use the form&lt;/P&gt;&lt;P&gt;npb4w+1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the variable is automatically retained and the summation is equivalent to using the sum function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 19:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48710#M13184</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-08-15T19:46:18Z</dc:date>
    </item>
    <item>
      <title>countif (using first function) comparing data sets; within the same household</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48711#M13185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, that's right, thank you for the clarification.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 19:47:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/countif-using-first-function-comparing-data-sets-within-the-same/m-p/48711#M13185</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-08-15T19:47:02Z</dc:date>
    </item>
  </channel>
</rss>

