<?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 successively increasing ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156579#M30583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hard code it. I didn't check to see if this matches your data, but the result should be the same. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by cohort;&lt;/P&gt;&lt;P&gt;retain first count;&lt;/P&gt;&lt;P&gt;if first.cohort then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if cohort="random" then first="PRL";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if cohort="high" then first="SRL";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count=0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;count+1;&lt;/P&gt;&lt;P&gt;newid=cats(first, put(count, z3.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Feb 2014 21:22:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-02-27T21:22:18Z</dc:date>
    <item>
      <title>Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156570#M30574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;G'day.&lt;/P&gt;&lt;P&gt;Appreciate any help you can give.&lt;/P&gt;&lt;P&gt;I'm in need of creating two successively increasing IDs for two cohorts:&lt;/P&gt;&lt;P&gt;Have:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cohort&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Facility &lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Emerson&lt;/P&gt;&lt;P&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Olive&lt;/P&gt;&lt;P&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inglewood&lt;/P&gt;&lt;P&gt;ETC...&lt;/P&gt;&lt;P&gt;High&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Montessori&lt;/P&gt;&lt;P&gt;High&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALIVA&lt;/P&gt;&lt;P&gt;ETC..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need a new ID starting with RAN001 for the random cohort all the way up to&amp;nbsp; RAN280&lt;/P&gt;&lt;P&gt;Also need a new ID starting with HIG001 for the 'High' cohort all the way up to HIG060&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Cohort&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Facility &lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;NEWID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Emerson&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAN001&lt;/P&gt;&lt;P&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Olive&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; RAN002&lt;/P&gt;&lt;P&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inglewood&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAN003&lt;/P&gt;&lt;P&gt;etc...&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;&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; RAN280&lt;/P&gt;&lt;P&gt;High&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Montessori&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HIG001&lt;/P&gt;&lt;P&gt;High&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALIVA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HIG002&lt;/P&gt;&lt;P&gt;etc...&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;&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; HIG060&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help you can give is appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 21:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156570#M30574</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-01-29T21:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156571#M30575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by cohort;&lt;/P&gt;&lt;P&gt;retain first count;&lt;/P&gt;&lt;P&gt;if first.cohort then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first=substr(upcase(cohort, 1,3));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count=0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;count+1;&lt;/P&gt;&lt;P&gt;newid=cats(first, put(count, z3.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 22:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156571#M30575</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-01-29T22:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156572#M30576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appreciate your quick reply.&lt;/P&gt;&lt;P&gt;I tried that but got the following error messages:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;245&amp;nbsp; data want;&lt;/P&gt;&lt;P&gt;246&lt;/P&gt;&lt;P&gt;247&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;248&lt;/P&gt;&lt;P&gt;249&amp;nbsp; by cohort;&lt;/P&gt;&lt;P&gt;250&lt;/P&gt;&lt;P&gt;251&amp;nbsp; retain first count;&lt;/P&gt;&lt;P&gt;252&lt;/P&gt;&lt;P&gt;253&amp;nbsp; if first.cohort then do;&lt;/P&gt;&lt;P&gt;254&lt;/P&gt;&lt;P&gt;255&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first=substr(upcase(cohort, 1,3));&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ------&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&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; ------&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; 71&lt;/P&gt;&lt;P&gt;ERROR 72-185: The UPCASE function call has too many arguments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 71-185: The SUBSTR function call does not have enough arguments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;256&lt;/P&gt;&lt;P&gt;257&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count=0;&lt;/P&gt;&lt;P&gt;258&lt;/P&gt;&lt;P&gt;259&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;260&lt;/P&gt;&lt;P&gt;261&amp;nbsp; count+1;&lt;/P&gt;&lt;P&gt;262&lt;/P&gt;&lt;P&gt;263&amp;nbsp; newid=cats(first, put(count, z3.));&lt;/P&gt;&lt;P&gt;264&lt;/P&gt;&lt;P&gt;265&amp;nbsp; run&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 16:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156572#M30576</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-02-06T16:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156573#M30577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wrong parenthesis, it should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; first=substr(upcase(cohort), 1, 3);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;PG&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 19:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156573#M30577</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-06T19:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156574#M30578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What if I wanted the newID for the random cohort to start with SRL and the new ID for the High cohort to start with PRL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156574#M30578</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-02-06T20:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156575#M30579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then you could use (untested) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;value $cohort&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"RANDOM"="SRL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"HIGH"="PRL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OTHER="XXX";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;by cohort;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;retain first count;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if first.cohort then do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first=put(upcase(cohort), $cohort.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count=0;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count+1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;newid=cats(first, put(count, z3.));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2014 21:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156575#M30579</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-06T21:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156576#M30580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&amp;nbsp; For some reason, it doesn't work. No SAS Log errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 01:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156576#M30580</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-02-26T01:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156577#M30581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some testing led to a bit of tweaking. This works (changes in red) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input Cohort $ Facility $; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Emerson&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Olive&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;random&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Inglewood&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;High&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Montessori&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;High&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALIVA&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;value $cohort&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"RANDOM"="SRL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"HIGH"="PRL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OTHER="XXX";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;by cohort &lt;SPAN style="color: #800000;"&gt;notsorted&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;retain first count;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if first.cohort then do;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; first=put(upcase(cohort), $cohort.);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count=0;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count+1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;newid=cats(first, put(count, z3.));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG&gt;drop first count;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=want noobs; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 03:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156577#M30581</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-26T03:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156578#M30582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appreciate you help. It's still not working for me and no log errors..Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 20:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156578#M30582</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-02-27T20:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156579#M30583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hard code it. I didn't check to see if this matches your data, but the result should be the same. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by cohort;&lt;/P&gt;&lt;P&gt;retain first count;&lt;/P&gt;&lt;P&gt;if first.cohort then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if cohort="random" then first="PRL";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if cohort="high" then first="SRL";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count=0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;count+1;&lt;/P&gt;&lt;P&gt;newid=cats(first, put(count, z3.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 21:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156579#M30583</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-02-27T21:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156580#M30584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; h1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; a1 $ a2 $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;random Emerson&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;random Olive&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;random Inglewood&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;High Montessori&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;High CALIVA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;=h1;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; a1;&lt;/SPAN&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; h2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; h1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; a1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; c &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;c+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; first.a1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;c=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; a1=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'random'&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;final=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'SRL'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; || trim(put(c,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;z3.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; a1=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'High'&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;final=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'PRL'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; || trim(put(c,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;z3.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps !!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 21:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156580#M30584</guid>
      <dc:creator>yeshwanth</dc:creator>
      <dc:date>2014-02-27T21:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156581#M30585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you know it didn't work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 22:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156581#M30585</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-02-27T22:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156582#M30586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appreciate your quick reply. Can you explain why the count= 0.&amp;nbsp; is inside the do loop?&amp;nbsp;&amp;nbsp; I will try this.&amp;nbsp; Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 21:21:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156582#M30586</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-02-28T21:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156583#M30587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It isn't a loop, it is conditional code that executes the first time you encounter an ID. The BY variable creates an automatic indicators for first. and last.&lt;/P&gt;&lt;P&gt;So the first time you see the ID you need to reassign variables.&amp;nbsp; It's set to 0, because the code after increments it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.lexjansen.com/nesug/nesug97/coders/scerbo.pdf" title="http://www.lexjansen.com/nesug/nesug97/coders/scerbo.pdf"&gt;http://www.lexjansen.com/nesug/nesug97/coders/scerbo.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 21:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156583#M30587</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-02-28T21:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156584#M30588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It didn't change the first three letters of the newid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 19:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156584#M30588</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-03-05T19:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156585#M30589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh. Got it!&amp;nbsp; Thank you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 19:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156585#M30589</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-03-05T19:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a successively increasing ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156586#M30590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 19:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-successively-increasing-ID/m-p/156586#M30590</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-03-05T19:51:36Z</dc:date>
    </item>
  </channel>
</rss>

