<?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: Keeping every 12 observations in a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506947#M135952</link>
    <description>&lt;P&gt;I'm not sure this is elegant, but it works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want1 want2;&lt;/P&gt;
&lt;P&gt;do _n_=1 to 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;link retrieve;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output want1;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;do _n_=1 to 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;link retrieve;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output want2;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;return;&lt;/P&gt;
&lt;P&gt;retrieve:&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;return;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By using the same SET statement, both loops continue reading the next observation, then the next, etc.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Oct 2018 17:51:20 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-10-23T17:51:20Z</dc:date>
    <item>
      <title>Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506932#M135944</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with 5472 observations but I would like to split it up into two datasets with 2736 observations each. I would like to do this by keeping the first 12 observations for the first dataset and the second 12 for the second, third 12 for the first, fourth 12 for the second, and so on. Is there a succinct way to do this? I am aware of the mod function but that only returns every nth value. Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:25:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506932#M135944</guid>
      <dc:creator>tbanh</dc:creator>
      <dc:date>2018-10-23T17:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506934#M135946</link>
      <description>Double MOD function?&lt;BR /&gt;retain group class;&lt;BR /&gt;if mod(_n_, 12) = 1 then group+1;&lt;BR /&gt;class = mod(group, 2);&lt;BR /&gt;&lt;BR /&gt;You can probably combine those as well.&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506934#M135946</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-23T17:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506943#M135951</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45835"&gt;@tbanh&lt;/a&gt;&amp;nbsp;Please go with squeaky clean&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s solution, here is some fun to play with &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do i=1 to 5472;
output;
end;
run;

data one two;
do _iorc_=1 to 2;
do _n_=1 to 12 until(lr);
set have end=lr;
if _iorc_=1 then output one;
else output two;
end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506943#M135951</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-23T17:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506947#M135952</link>
      <description>&lt;P&gt;I'm not sure this is elegant, but it works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want1 want2;&lt;/P&gt;
&lt;P&gt;do _n_=1 to 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;link retrieve;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output want1;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;do _n_=1 to 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;link retrieve;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output want2;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;return;&lt;/P&gt;
&lt;P&gt;retrieve:&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;return;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By using the same SET statement, both loops continue reading the next observation, then the next, etc.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506947#M135952</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-23T17:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506948#M135953</link>
      <description>&lt;P&gt;12 makes me think it's monthly data, is there perhaps another variable that would identify the groups? If so, there are ways to make this entirely data driven.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506948#M135953</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-23T17:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506950#M135954</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No it is not monthly data. I had PROC MCMC output simulated data from the posterior distribution for predicted values. Each individual (N = 228) had observations representing a quantitative task and a verbal task, thus my wanting to separate each individual's observations into a quantitative dataset and a verbal dataset. Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506950#M135954</guid>
      <dc:creator>tbanh</dc:creator>
      <dc:date>2018-10-23T17:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping every 12 observations in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506987#M135976</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45835"&gt;@tbanh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No it is not monthly data. I had PROC MCMC output simulated data from the posterior distribution for predicted values. Each individual (N = 228) had observations representing a quantitative task and a verbal task, thus my wanting to separate each individual's observations into a quantitative dataset and a verbal dataset. Thank you for your help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you have a variable that indicates if it's qualitative or quantitative? Trusting an implied order is a risky game.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keeping-every-12-observations-in-a-dataset/m-p/506987#M135976</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-23T19:23:59Z</dc:date>
    </item>
  </channel>
</rss>

