<?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: Help in Appending two dataset in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18478#M3633</link>
    <description>Maybe not the most ideal way, but what about:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data A;&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
c=5*i;&lt;BR /&gt;
n + (mod(i-1,3)=0);&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data B;&lt;BR /&gt;
c=25;i=66;n+1;output;&lt;BR /&gt;
c=75;i=99;n+1;output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data C;&lt;BR /&gt;
set A B;&lt;BR /&gt;
by n;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Edit: fixed to work after 3 rows of table A, instead of 2.

Message was edited by: DF</description>
    <pubDate>Tue, 21 Jun 2011 16:00:06 GMT</pubDate>
    <dc:creator>DF</dc:creator>
    <dc:date>2011-06-21T16:00:06Z</dc:date>
    <item>
      <title>Help in Appending two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18477#M3632</link>
      <description>Hi i have two dataset. dataset a and dataset b. suppose dataset a has 10 records and data set b has 3 records.. I want to append record from dataset b after every 3 records of dataset a.&lt;BR /&gt;
 &lt;BR /&gt;
data A;&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
c=5*i;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
data B;&lt;BR /&gt;
c=25;i=66;output;&lt;BR /&gt;
c=75;i=99;output;&lt;BR /&gt;
run;&lt;BR /&gt;
I tired  following:&lt;BR /&gt;
data temp;&lt;BR /&gt;
set a;&lt;BR /&gt;
output;&lt;BR /&gt;
do i = 3 to 10 by 3;&lt;BR /&gt;
if _n_ =i then do;&lt;BR /&gt;
set b;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
My issue in the above code is sas iteration depends on the number of records of smallest dataset. hw to over above issue.. any 1 with help plz</description>
      <pubDate>Tue, 21 Jun 2011 15:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18477#M3632</guid>
      <dc:creator>Rockers</dc:creator>
      <dc:date>2011-06-21T15:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Appending two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18478#M3633</link>
      <description>Maybe not the most ideal way, but what about:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data A;&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
c=5*i;&lt;BR /&gt;
n + (mod(i-1,3)=0);&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data B;&lt;BR /&gt;
c=25;i=66;n+1;output;&lt;BR /&gt;
c=75;i=99;n+1;output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data C;&lt;BR /&gt;
set A B;&lt;BR /&gt;
by n;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Edit: fixed to work after 3 rows of table A, instead of 2.

Message was edited by: DF</description>
      <pubDate>Tue, 21 Jun 2011 16:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18478#M3633</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-06-21T16:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Appending two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18479#M3634</link>
      <description>How about:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data A;&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
c=5*i;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data B;&lt;BR /&gt;
c=25;i=66;output;&lt;BR /&gt;
c=75;i=99;output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
 set a;&lt;BR /&gt;
 output;&lt;BR /&gt;
 if mod(_n_,3)=0  then do;&lt;BR /&gt;
    do k=1 to _nobs;&lt;BR /&gt;
     set b nobs=_nobs point=k;output;&lt;BR /&gt;
    end;&lt;BR /&gt;
                        end;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 22 Jun 2011 02:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18479#M3634</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-22T02:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Appending two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18480#M3635</link>
      <description>Thanks DF and Ksharp....but I was trying to do that in a single data step.. however in the code suggested by sharp.. al the records are getting appended each time...that is if data set A has 10 records and dataset B has 2 records.. instead of having 12 records in &lt;B&gt;Want&lt;/B&gt; dataset i am getting 16 records...</description>
      <pubDate>Wed, 22 Jun 2011 04:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18480#M3635</guid>
      <dc:creator>Rockers</dc:creator>
      <dc:date>2011-06-22T04:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Appending two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18481#M3636</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
Ksharp's approach which the little fix needed:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data A;&lt;BR /&gt;
  do i = 1 to 10;&lt;BR /&gt;
    c=5*i;&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data B;&lt;BR /&gt;
  c=25;i=66;output;&lt;BR /&gt;
  c=75;i=99;output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
  set a;&lt;BR /&gt;
  output;&lt;BR /&gt;
  &lt;BR /&gt;
  if mod(_n_,3)=0 then&lt;BR /&gt;
  do;&lt;BR /&gt;
    ind+1;&lt;BR /&gt;
    if ind&amp;lt;=nobs then&lt;BR /&gt;
      set b point=ind nobs=nobs;&lt;BR /&gt;
      output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=want;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Wed, 22 Jun 2011 05:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18481#M3636</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-06-22T05:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help in Appending two dataset</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18482#M3637</link>
      <description>Patrick give a better code.Thanks Patrick!&lt;BR /&gt;
Since you did not post output you need, so it is hard to code exactly.&lt;BR /&gt;
You want append only one record after every three records in A?&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data A;&lt;BR /&gt;
do i = 1 to 10;&lt;BR /&gt;
c=5*i;&lt;BR /&gt;
output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data B;&lt;BR /&gt;
c=25;i=66;output;&lt;BR /&gt;
c=75;i=99;output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
 set a;&lt;BR /&gt;
 output;&lt;BR /&gt;
 if mod(_n_,3)=0  then do;&lt;BR /&gt;
     count+1;&lt;BR /&gt;
     if count le _nobs then do;&lt;BR /&gt;
     set b point=count nobs=_nobs;&lt;BR /&gt;
     output;&lt;BR /&gt;
       end;&lt;BR /&gt;
    end;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Wed, 22 Jun 2011 06:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-in-Appending-two-dataset/m-p/18482#M3637</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-22T06:07:39Z</dc:date>
    </item>
  </channel>
</rss>

