<?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: counting variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166005#M263736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this, where name variable contains the dr.smith, and new_name would be with the number:&lt;/P&gt;&lt;P&gt;data inter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain cnt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_=1 or first.name then cnt=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else cnt=cnt+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_name=strip(name)||put(cnt,z3.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 May 2014 13:01:21 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2014-05-20T13:01:21Z</dc:date>
    <item>
      <title>counting variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166004#M263735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Situation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dr. Smith has 3 addresses, I need to add a counting variable to the end of his name to indicate that all the addresses belong to him.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dr. Smith 123 Main St&lt;/P&gt;&lt;P&gt;Dr. Smith 45112 East River Rd&lt;/P&gt;&lt;P&gt;Dr. Smith 621 Carnegie Blvd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to show the data as&lt;/P&gt;&lt;P&gt;Dr. Smith-001 123 Main St&lt;/P&gt;&lt;P&gt;Dr. Smith-002 45112 East River Rd&lt;/P&gt;&lt;P&gt;Dr. Smith-003 621 Carnegie Blvd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know what this is called to be able to research how to code this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 12:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166004#M263735</guid>
      <dc:creator>SVoldrich</dc:creator>
      <dc:date>2014-05-20T12:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: counting variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166005#M263736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this, where name variable contains the dr.smith, and new_name would be with the number:&lt;/P&gt;&lt;P&gt;data inter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain cnt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by name;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_=1 or first.name then cnt=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else cnt=cnt+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_name=strip(name)||put(cnt,z3.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 13:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166005#M263736</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-05-20T13:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: counting variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166006#M263737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the term you want is 'Slowly Changing Dimension'.&amp;nbsp; Typically this would apply where one of the addresses is regarded as current while the others are previous addresses.&amp;nbsp; Again, typically, there would be 'From' and&amp;nbsp; 'To' dates associated with the records to show the history.&amp;nbsp; The latest record would have a null 'To' date, or one far in the future such as 31DEC9999.&amp;nbsp; A separate column might also be used to flag which record is the current one, to simplify queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 13:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166006#M263737</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2014-05-20T13:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: counting variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166007#M263738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard - Nope, they are all current addresses. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 13:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166007#M263738</guid>
      <dc:creator>SVoldrich</dc:creator>
      <dc:date>2014-05-20T13:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: counting variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166008#M263739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll research that RW9 -&lt;/P&gt;&lt;P&gt;Not everything in that code makes sense to me, but I will research it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 13:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-variables/m-p/166008#M263739</guid>
      <dc:creator>SVoldrich</dc:creator>
      <dc:date>2014-05-20T13:19:58Z</dc:date>
    </item>
  </channel>
</rss>

