<?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: Count and Seperate dataset? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527083#M143641</link>
    <description>&lt;P&gt;For #1 try this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For #2, PROC SORT has a newer option, NOUNIQUEKEY that makes this trivial.&lt;/P&gt;
&lt;P&gt;But ID 100 has two entries for seasons, for season 9 there are duplicates, for season 10 there are no duplicates. So you want all ID 100 records to go into a different data set or just the duplicates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the test dataset list below.&amp;nbsp;&amp;nbsp; I would like to do two things:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Assign the count number like the "Count" column below&lt;/P&gt;
&lt;P&gt;2. Separate those two datasets if the ID and season are duplicate.&amp;nbsp; For example, dataset one is including IDs '100', 200', '305', and '410'.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The other dataset is the rest IDs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
datalines;
100, 9,  1,  ,
100, 9,  2,  ,
100, 10,  1,  ,
112, 14,  1,  ,
150, 14,  1,  ,
180, 14,  1,  ,
181, 15,  1,  ,
200, 15,  1,  ,
200, 15,  2,   ,
200, 15,  3,   ,
200, 17,  1,   ,
210, 8,  1,   ,
270, 10,  1,   ,
280, 11,  1,   ,
305, 11,   1,  ,
305, 11,   2,  ,
322, 16,   1,  ,
377, 16,   1,  ,
410, 8,   1,  ,
410, 8,   2,  ,
421, 10,   1,  ,
422, 10,   1,  ,
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 20:14:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-01-14T20:14:55Z</dc:date>
    <item>
      <title>Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527077#M143638</link>
      <description>&lt;P&gt;Hi experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the test dataset list below.&amp;nbsp;&amp;nbsp; I would like to do three things:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Assign the count number like the "Count" column below.&lt;/P&gt;
&lt;P&gt;2. Create a column&amp;nbsp;'i' the same as the column 'Count'.&lt;/P&gt;
&lt;P&gt;3. Separate those two datasets if the ID and season are duplicates.&amp;nbsp; For example, dataset one is including IDs '100', 200', '305', and '410'.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The other dataset is the rest IDs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
datalines;
100, 9,  1,  ,
100, 9,  2,  ,
100, 10,  1,  ,
112, 14,  1,  ,
150, 14,  1,  ,
180, 14,  1,  ,
181, 15,  1,  ,
200, 15,  1,  ,
200, 15,  2,   ,
200, 15,  3,   ,
200, 17,  1,   ,
210, 8,  1,   ,
270, 10,  1,   ,
280, 11,  1,   ,
305, 11,   1,  ,
305, 11,   2,  ,
322, 16,   1,  ,
377, 16,   1,  ,
410, 8,   1,  ,
410, 8,   2,  ,
421, 10,   1,  ,
422, 10,   1,  ,
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the datasets I want are&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data One;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
datalines;
100, 10,  1,  1,
112, 14,  1,  1,
150, 14,  1,  1,
180, 14,  1,  1,
181, 15,  1,  1,
200, 17,  1,   1,
210, 8,  1,   1,
270, 10,  1,   1,
280, 11,  1,   1,
322, 16,   1,  1,
377, 16,   1,  1,
421, 10,   1,  1,
422, 10,   1,  1,
;

data two;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
datalines;
100, 9,  1,  1,
100, 9,  2,  2,
200, 15,  1,  1,
200, 15,  2,   2,
200, 15,  3,   3,
305, 11,   1,  1,
305, 11,   2,  2,
410, 8,   1,  1,
410, 8,   2,  2,
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527077#M143638</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-01-14T22:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527081#M143639</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
  drop count;
datalines;
100, 9,  1,  ,
100, 9,  2,  ,
100, 10,  1,  ,
112, 14,  1,  ,
150, 14,  1,  ,
180, 14,  1,  ,
181, 15,  1,  ,
200, 15,  1,  ,
200, 15,  2,   ,
200, 15,  3,   ,
200, 17,  1,   ,
210, 8,  1,   ,
270, 10,  1,   ,
280, 11,  1,   ,
305, 11,   1,  ,
305, 11,   2,  ,
322, 16,   1,  ,
377, 16,   1,  ,
410, 8,   1,  ,
410, 8,   2,  ,
421, 10,   1,  ,
422, 10,   1,  ,
;

data one two;
do until(last.id);
do count=1 by 1 until(last.season);
set test;
by id season;
end;
if  first.id and last.id then output two;
else output one;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 20:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527081#M143639</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T20:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527083#M143641</link>
      <description>&lt;P&gt;For #1 try this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For #2, PROC SORT has a newer option, NOUNIQUEKEY that makes this trivial.&lt;/P&gt;
&lt;P&gt;But ID 100 has two entries for seasons, for season 9 there are duplicates, for season 10 there are no duplicates. So you want all ID 100 records to go into a different data set or just the duplicates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the test dataset list below.&amp;nbsp;&amp;nbsp; I would like to do two things:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Assign the count number like the "Count" column below&lt;/P&gt;
&lt;P&gt;2. Separate those two datasets if the ID and season are duplicate.&amp;nbsp; For example, dataset one is including IDs '100', 200', '305', and '410'.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The other dataset is the rest IDs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
datalines;
100, 9,  1,  ,
100, 9,  2,  ,
100, 10,  1,  ,
112, 14,  1,  ,
150, 14,  1,  ,
180, 14,  1,  ,
181, 15,  1,  ,
200, 15,  1,  ,
200, 15,  2,   ,
200, 15,  3,   ,
200, 17,  1,   ,
210, 8,  1,   ,
270, 10,  1,   ,
280, 11,  1,   ,
305, 11,   1,  ,
305, 11,   2,  ,
322, 16,   1,  ,
377, 16,   1,  ,
410, 8,   1,  ,
410, 8,   2,  ,
421, 10,   1,  ,
422, 10,   1,  ,
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 20:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527083#M143641</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-14T20:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527086#M143643</link>
      <description>&lt;P&gt;or perhaps this--?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one two;
do count=1 by 1 until(last.season);
set test;
by id season;
if  first.id and last.id then output two;
else output one;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 20:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527086#M143643</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T20:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527088#M143644</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
      infile datalines dsd;
  input ID : $10. Season;
datalines;
100, 9
100, 9
100, 10
112, 14
150, 14
180, 14
181, 15
200, 15
200, 15
200, 15
200, 17
210, 8
270, 10
280, 11
305, 11
305, 11
322, 16
377, 16
410, 8
410, 8
421, 10
422, 10
;

data temp;
   set test;
   by ID Season;
   count+1;
   if first.Season then count=1;
run;

data singles duplicates;
   
   if _N_ = 1 then do;
   declare hash h(dataset:'temp(where=(count&amp;gt;1))');
      h.defineKey('ID');
      h.defineDone();
   end;

   set temp;

   if h.check()=0 then output duplicates;
   else output singles;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 20:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527088#M143644</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-14T20:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527136#M143652</link>
      <description>&lt;P&gt;If the DOW loop was little confusing, the requirement is as simple as this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a matter of diligent use of automativ by group variables first and last&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data test;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
  drop count;
datalines;
100, 9,  1,  ,
100, 9,  2,  ,
100, 10,  1,  ,
112, 14,  1,  ,
150, 14,  1,  ,
180, 14,  1,  ,
181, 15,  1,  ,
200, 15,  1,  ,
200, 15,  2,   ,
200, 15,  3,   ,
200, 17,  1,   ,
210, 8,  1,   ,
270, 10,  1,   ,
280, 11,  1,   ,
305, 11,   1,  ,
305, 11,   2,  ,
322, 16,   1,  ,
377, 16,   1,  ,
410, 8,   1,  ,
410, 8,   2,  ,
421, 10,   1,  ,
422, 10,   1,  ,
;


data one two;
set test;
by id season;
if  first.season then count=1;
else count+1;
if first.id and last.id then output two;
else output one;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527136#M143652</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T21:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527151#M143659</link>
      <description>&lt;P&gt;Personally, I feel the requirement is much easier than having to use hash. However, I appreciate your enthusiam in offering various solutions. That's so cool. Love that attitude!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even with hash, you could consider just one step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
      infile datalines dsd;
  input ID : $10. Season  Count   i ;
  drop count;
datalines;
100, 9,  1,  ,
100, 9,  2,  ,
100, 10,  1,  ,
112, 14,  1,  ,
150, 14,  1,  ,
180, 14,  1,  ,
181, 15,  1,  ,
200, 15,  1,  ,
200, 15,  2,   ,
200, 15,  3,   ,
200, 17,  1,   ,
210, 8,  1,   ,
270, 10,  1,   ,
280, 11,  1,   ,
305, 11,   1,  ,
305, 11,   2,  ,
322, 16,   1,  ,
377, 16,   1,  ,
410, 8,   1,  ,
410, 8,   2,  ,
421, 10,   1,  ,
422, 10,   1,  ,
;

data one two;
if _n_=1 then do;
   dcl hash H (dataset:'test',multidata:'y') ;
   h.definekey  ("id") ;
   h.definedata ("id") ;
   h.definedone () ;
 end;
 set test;
 by id season;
if  first.season then count=1;
else count+1;
if first.id then do;rc=h.check(); h.has_next(result:_iorc_);end;
if _iorc_ then output one;else output two;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527151#M143659</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T21:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527159#M143662</link>
      <description>&lt;P&gt;Hi all:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, the result I am looking for is not what you created.&amp;nbsp; &amp;nbsp;Please see my edited first message.&amp;nbsp; &amp;nbsp;Sorry for the confusion.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:11:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527159#M143662</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-01-14T22:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527160#M143663</link>
      <description>&lt;PRE&gt;proc sort data=have uniqueout=unique nouniquekey out=duplicates;
by ID season;
run;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately, the result I am looking for is not what you created.&amp;nbsp; &amp;nbsp;Please see my edited first message.&amp;nbsp; &amp;nbsp;Sorry for the confusion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please don't edit your posts, it makes it harder to follow later on. Use a new response.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527160#M143663</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-14T22:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527162#M143665</link>
      <description>&lt;P&gt;I have used the same code, it did not work.&amp;nbsp; &amp;nbsp;Please see the result I want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527162#M143665</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-01-14T22:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527164#M143667</link>
      <description>&lt;P&gt;OK here you go&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one two;
set test;
by id season;
if  first.season then count=1;
else count+1;
if first.season and last.season then output one;
else output two;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527164#M143667</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T22:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527165#M143668</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;The change is very minor&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we use first.season and last.season, instead of first.id and last.id pairs&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527165#M143668</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-14T22:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527166#M143669</link>
      <description>&lt;P&gt;I tested it, it works exactly as requested given your sample data. The rest is up to you now.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have used the same code, it did not work.&amp;nbsp; &amp;nbsp;Please see the result I want.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 22:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527166#M143669</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-14T22:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527183#M143676</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have used the same code, it did not work.&amp;nbsp; &amp;nbsp;Please see the result I want.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 23:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527183#M143676</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-14T23:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527194#M143680</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you created was good.&amp;nbsp; However, I also need the column 'i' is exactly the same as column 'count' because I need to use it for further transpose.&amp;nbsp; The column 'count' you have is not the one I want.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; one two&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; test&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt; season&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt;  &lt;SPAN class="token function"&gt;first&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;season &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;first&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;season and last&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;season &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; output one&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; output two&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 01:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527194#M143680</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-01-15T01:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527196#M143681</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you created was good.&amp;nbsp;&lt;STRONG&gt; However, I also need the column 'i' is exactly the same as column 'count'&lt;/STRONG&gt; because I need to use it for further transpose.&amp;nbsp; The column 'count' you have is not the one I want.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; one two&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; test&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt; season&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt;  &lt;SPAN class="token function"&gt;first&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;season &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;first&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;season and last&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;season &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; output one&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; output two&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I is blank in your sample data and if you want it exactly as count, why not just assign it? If count already exists on the data set the RETAIN won't work correctly. You do not need to add a counter to this automatically when transposing, SAS does that automatically.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 01:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527196#M143681</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-15T01:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527296#M143726</link>
      <description>&lt;P&gt;The column 'count' I created was used to check whether the column 'i' was created in the right way.&amp;nbsp; That was why I leave column 'i' in blank.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 13:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527296#M143726</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-01-15T13:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Seperate dataset?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527573#M143842</link>
      <description>&lt;P&gt;You didn’t initially state that, but I see you’ve edited your original post to now say it. This is why ask that you not edit, but post update or new messages instead. Ultimately your choice of course. Either way, changing the name should solve your problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The column 'count' I created was used to check whether the column 'i' was created in the right way.&amp;nbsp; That was why I leave column 'i' in blank.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 00:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Seperate-dataset/m-p/527573#M143842</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-16T00:25:08Z</dc:date>
    </item>
  </channel>
</rss>

