<?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 the number of Observation by variable and then divide them by 4 and create new coloumn in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295170#M61658</link>
    <description>&lt;P&gt;I Think I didn't explain correctly so output i want will be&lt;/P&gt;&lt;P&gt;spool dose number batch quarter&lt;/P&gt;&lt;P&gt;su 30 1 rx1 1&lt;/P&gt;&lt;P&gt;su 30 2 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;su 30 3 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;su 30 4 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;1 30 5 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;2 30 6 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;sp 30 7 rx1 2&lt;/P&gt;&lt;P&gt;su 30 8 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;4 30 9 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;5 30 10 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;6 30 11 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;su 14 12 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;su 14 13 rx1 3&lt;/P&gt;&lt;P&gt;su 14 14 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;su 14 15 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;1 14 16 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;2 14 17 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;3 14 18 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;su 14 19 rx1 4&lt;/P&gt;&lt;P&gt;4 14 20 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;5 14 21 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;failure 14 22&amp;nbsp;rx1 &amp;nbsp;4&lt;/P&gt;&lt;P&gt;su 14 23 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;su 14 24 rx1 &amp;nbsp;4&lt;/P&gt;&lt;P&gt;su 14 25 rx1 &amp;nbsp;4&lt;/P&gt;&lt;P&gt;1 14 26 rx1&amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;2 14 27 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;&amp;nbsp;and so on for batch rx2&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2016 14:08:58 GMT</pubDate>
    <dc:creator>dpa</dc:creator>
    <dc:date>2016-08-30T14:08:58Z</dc:date>
    <item>
      <title>Count the number of Observation by variable and then divide them by 4 and create new coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295150#M61646</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; spool_number $ dose number batch $;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datalines&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;su 30 1 rx1&lt;/P&gt;&lt;P&gt;su 30 2 rx1&lt;/P&gt;&lt;P&gt;su 30 3 rx1&lt;/P&gt;&lt;P&gt;su 30 4 rx1&lt;/P&gt;&lt;P&gt;1 30 5 rx1&lt;/P&gt;&lt;P&gt;2 30 6 rx1&lt;/P&gt;&lt;P&gt;sp 30 7 rx1&lt;/P&gt;&lt;P&gt;su 30 8 rx1&lt;/P&gt;&lt;P&gt;4 30 9 rx1&lt;/P&gt;&lt;P&gt;5 30 10 rx1&lt;/P&gt;&lt;P&gt;6 30 11 rx1&lt;/P&gt;&lt;P&gt;su 14 12 rx1&lt;/P&gt;&lt;P&gt;su 14 13 rx1&lt;/P&gt;&lt;P&gt;su 14 14 rx1&lt;/P&gt;&lt;P&gt;su 14 15 rx1&lt;/P&gt;&lt;P&gt;1 14 16 rx1&lt;/P&gt;&lt;P&gt;2 14 17 rx1&lt;/P&gt;&lt;P&gt;3 14 18 rx1&lt;/P&gt;&lt;P&gt;su 14 19 rx1&lt;/P&gt;&lt;P&gt;4 14 20 rx1&lt;/P&gt;&lt;P&gt;5 14 21 rx1&lt;/P&gt;&lt;P&gt;failure 14 22 rx1&lt;/P&gt;&lt;P&gt;su 14 23 rx1&lt;/P&gt;&lt;P&gt;su 14 24 rx1&lt;/P&gt;&lt;P&gt;su 14 25 rx1&lt;/P&gt;&lt;P&gt;1 14 26 rx1&lt;/P&gt;&lt;P&gt;2 14 27 rx1&lt;/P&gt;&lt;P&gt;su 30 1 rx2&lt;/P&gt;&lt;P&gt;su 30 2 rx2&lt;/P&gt;&lt;P&gt;su 30 3 rx2&lt;/P&gt;&lt;P&gt;su 30 4 rx2&lt;/P&gt;&lt;P&gt;1 30 5 rx2&lt;/P&gt;&lt;P&gt;2 30 6 rx2&lt;/P&gt;&lt;P&gt;sp 30 7 rx2&lt;/P&gt;&lt;P&gt;su 30 8 rx2&lt;/P&gt;&lt;P&gt;4 30 9 rx2&lt;/P&gt;&lt;P&gt;5 30 10 rx2&lt;/P&gt;&lt;P&gt;6 30 11 rx2&lt;/P&gt;&lt;P&gt;su 14 12 rx2&lt;/P&gt;&lt;P&gt;su 14 13 rx2&lt;/P&gt;&lt;P&gt;su 14 14 rx2&lt;/P&gt;&lt;P&gt;su 14 15 rx2&lt;/P&gt;&lt;P&gt;1 14 16 rx2&lt;/P&gt;&lt;P&gt;2 14 17 rx2&lt;/P&gt;&lt;P&gt;3 14 18 rx2&lt;/P&gt;&lt;P&gt;su 14 19 rx2&lt;/P&gt;&lt;P&gt;4 14 20 rx2&lt;/P&gt;&lt;P&gt;5 14 21 rx2&lt;/P&gt;&lt;P&gt;failure 14 22 rx2&lt;/P&gt;&lt;P&gt;su 14 23 rx2&lt;/P&gt;&lt;P&gt;su 14 24 rx2&lt;/P&gt;&lt;P&gt;su 14 25 rx2&lt;/P&gt;&lt;P&gt;1 14 26 rx2&lt;/P&gt;&lt;P&gt;2 14 27 rx2&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; have2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; have ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; batch &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;notsorted&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; first.batch &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; count=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;count+&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; last.batch &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;proc&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;print&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;=have2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Now I want to divide the count by 4 for each batch and then create new coloumn with value of q1 q2 q3 and q4.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Hope it make sense,.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 13:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295150#M61646</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-30T13:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of Observation by variable and then divide them by 4 and create new coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295157#M61650</link>
      <description>&lt;P&gt;Your test datastep fails. &amp;nbsp;To your question, can you not add in this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have2;
  set have ;
  by batch notsorted;
  if first.batch then count=0;
  count+1;
  qtr=cats("Q",put(ceil(count/4),best.));
  if last.batch then output;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Aug 2016 13:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295157#M61650</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-30T13:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of Observation by variable and then divide them by 4 and create new coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295158#M61651</link>
      <description>&lt;P&gt;So it's not an aggregate&amp;nbsp;count, rather a sequence&amp;nbsp;no within each BY group.&lt;/P&gt;
&lt;P&gt;Can't see why you wish to store equal values in four new columns, what can be the requirement for this?&lt;/P&gt;
&lt;P&gt;But to me, just do the divide and assignment in the same step as creating the "count"....?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 13:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295158#M61651</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-08-30T13:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of Observation by variable and then divide them by 4 and create new coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295166#M61656</link>
      <description>&lt;P&gt;One solution,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input spool_number $ dose number batch $;
datalines;
su 30 1 rx1
su 30 2 rx1
su 30 3 rx1
su 30 4 rx1
1 30 5 rx1
2 30 6 rx1
sp 30 7 rx1
su 30 8 rx1
4 30 9 rx1
5 30 10 rx1
6 30 11 rx1
su 14 12 rx1
su 14 13 rx1
su 14 14 rx1
su 14 15 rx1
1 14 16 rx1
2 14 17 rx1
3 14 18 rx1
su 14 19 rx1
4 14 20 rx1
5 14 21 rx1
failure 14 22 rx1
su 14 23 rx1
su 14 24 rx1
su 14 25 rx1
1 14 26 rx1
2 14 27 rx1
su 30 1 rx2
su 30 2 rx2
su 30 3 rx2
su 30 4 rx2
1 30 5 rx2
2 30 6 rx2
sp 30 7 rx2
su 30 8 rx2
4 30 9 rx2
5 30 10 rx2
6 30 11 rx2
su 14 12 rx2
su 14 13 rx2
su 14 14 rx2
su 14 15 rx2
1 14 16 rx2
2 14 17 rx2
3 14 18 rx2
su 14 19 rx2
4 14 20 rx2
5 14 21 rx2
failure 14 22 rx2
su 14 23 rx2
su 14 24 rx2
su 14 25 rx2
1 14 26 rx2
2 14 27 rx2
run;



data want;
	do _n_=1 by 1 until (last.batch);
		set test;
		by batch notsorted;
		new_var=cats('q',ifn(mod(_n_,4)=0,4,mod(_n_,4)));
		output;
	end;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Aug 2016 14:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295166#M61656</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-08-30T14:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of Observation by variable and then divide them by 4 and create new coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295170#M61658</link>
      <description>&lt;P&gt;I Think I didn't explain correctly so output i want will be&lt;/P&gt;&lt;P&gt;spool dose number batch quarter&lt;/P&gt;&lt;P&gt;su 30 1 rx1 1&lt;/P&gt;&lt;P&gt;su 30 2 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;su 30 3 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;su 30 4 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;1 30 5 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;2 30 6 rx1&amp;nbsp;1&lt;/P&gt;&lt;P&gt;sp 30 7 rx1 2&lt;/P&gt;&lt;P&gt;su 30 8 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;4 30 9 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;5 30 10 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;6 30 11 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;su 14 12 rx1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;su 14 13 rx1 3&lt;/P&gt;&lt;P&gt;su 14 14 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;su 14 15 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;1 14 16 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;2 14 17 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;3 14 18 rx1&amp;nbsp;3&lt;/P&gt;&lt;P&gt;su 14 19 rx1 4&lt;/P&gt;&lt;P&gt;4 14 20 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;5 14 21 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;failure 14 22&amp;nbsp;rx1 &amp;nbsp;4&lt;/P&gt;&lt;P&gt;su 14 23 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;su 14 24 rx1 &amp;nbsp;4&lt;/P&gt;&lt;P&gt;su 14 25 rx1 &amp;nbsp;4&lt;/P&gt;&lt;P&gt;1 14 26 rx1&amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;2 14 27 rx1&amp;nbsp;4&lt;/P&gt;&lt;P&gt;&amp;nbsp;and so on for batch rx2&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2016 14:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295170#M61658</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-30T14:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of Observation by variable and then divide them by 4 and create new coloumn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295186#M61665</link>
      <description>&lt;P&gt;Not sure if you want the 'q' or not, here is the version with 'q', it gets simpler without 'q',&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	do _n_=1 by 1 until (last.batch);
		set test;
		by batch notsorted;
	end;
	_cyc=ceil(_n_/4);
	do _n_=1 by 1 until (last.batch);
		set test;
		by batch notsorted;
    new_var=cats('q', ceil(_n_/_cyc));
	output;
	end;
	drop _cyc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Aug 2016 14:28:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-Observation-by-variable-and-then-divide-them/m-p/295186#M61665</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-08-30T14:28:06Z</dc:date>
    </item>
  </channel>
</rss>

