<?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 Creating a new variable that counts number of occurences in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193347#M48547</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a set of survey data which gives each person's personal identification code (lets call this variable ID for now). Most people were called more than once, and each time they were called, they are added as a separate entry in the data set, therefore there are many duplicate personal identification codes, but with different values for other variables (which are the questions they were asked).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I collapsed the ID variable so each unique id only shows up once in the data set (I am creating new summary variables and dropping all other variables in the original data set). I would like to create a variable that sums the number of times the ID was duplicated to show the number of times the person was called. Does anyone know how to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I want this new variable to be what a proc freq on the ID variable would reveal, and I will create it before I collapse the ID variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't use first.ID/last.ID because it requires me to collapse the ID variable first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Mar 2015 23:38:20 GMT</pubDate>
    <dc:creator>summerkk</dc:creator>
    <dc:date>2015-03-03T23:38:20Z</dc:date>
    <item>
      <title>Creating a new variable that counts number of occurences</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193347#M48547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a set of survey data which gives each person's personal identification code (lets call this variable ID for now). Most people were called more than once, and each time they were called, they are added as a separate entry in the data set, therefore there are many duplicate personal identification codes, but with different values for other variables (which are the questions they were asked).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I collapsed the ID variable so each unique id only shows up once in the data set (I am creating new summary variables and dropping all other variables in the original data set). I would like to create a variable that sums the number of times the ID was duplicated to show the number of times the person was called. Does anyone know how to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I want this new variable to be what a proc freq on the ID variable would reveal, and I will create it before I collapse the ID variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't use first.ID/last.ID because it requires me to collapse the ID variable first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 23:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193347#M48547</guid>
      <dc:creator>summerkk</dc:creator>
      <dc:date>2015-03-03T23:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable that counts number of occurences</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193348#M48548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use a SQL query - this will work in SAS but isn't ANSI SQL, so won't work in other SQL systems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select *, count(id) as Num_ID&lt;/P&gt;&lt;P&gt;from have&lt;/P&gt;&lt;P&gt;group by ID&lt;/P&gt;&lt;P&gt;order by ID;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 00:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193348#M48548</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-04T00:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable that counts number of occurences</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193349#M48549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much, it worked!! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 15:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-new-variable-that-counts-number-of-occurences/m-p/193349#M48549</guid>
      <dc:creator>summerkk</dc:creator>
      <dc:date>2015-03-04T15:08:27Z</dc:date>
    </item>
  </channel>
</rss>

