<?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: Dynamically repeat observations in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5087#M2060</link>
    <description>have you tried this?&lt;BR /&gt;
&lt;BR /&gt;
data two (drop=i);&lt;BR /&gt;
  set one;&lt;BR /&gt;
  do i = 1 to num;&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;</description>
    <pubDate>Tue, 16 Oct 2007 16:43:11 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-10-16T16:43:11Z</dc:date>
    <item>
      <title>Dynamically repeat observations</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5085#M2058</link>
      <description>I want to repeat an observation in a dataset based on the value in a field.  I know this is usually the opposite of what most do.  Let me explain: I am running a small contest and have the number of "tickets" each participant has.  Therefore once I explode the dataset, I can assign a random number to each observation and select a winner.&lt;BR /&gt;
&lt;BR /&gt;
My Data looks like this:&lt;BR /&gt;
name      tickets&lt;BR /&gt;
aaa         1&lt;BR /&gt;
bbb         2&lt;BR /&gt;
ccc         1&lt;BR /&gt;
ddd         3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
What I want in the end is:&lt;BR /&gt;
name      tickets&lt;BR /&gt;
aaa         1&lt;BR /&gt;
bbb         2&lt;BR /&gt;
bbb         2&lt;BR /&gt;
ccc         1&lt;BR /&gt;
ddd         3&lt;BR /&gt;
ddd         3&lt;BR /&gt;
ddd         3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Any ideas ?</description>
      <pubDate>Tue, 16 Oct 2007 13:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5085#M2058</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-16T13:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically repeat observations</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5086#M2059</link>
      <description>This is where I am at so far.&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
input name $3. num 8.;&lt;BR /&gt;
cards;&lt;BR /&gt;
aaa 3&lt;BR /&gt;
bbb 1&lt;BR /&gt;
ccc 2&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%macro myrepeat(howmany);&lt;BR /&gt;
%do i= 1 %to &amp;amp;howmany;&lt;BR /&gt;
	output;&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
data two;&lt;BR /&gt;
	set one;&lt;BR /&gt;
	%myrepeat(num);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
But I am getting an error message:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The&lt;BR /&gt;
       condition was: &amp;amp;howmany&lt;BR /&gt;
ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;
ERROR: The macro MYREPEAT will stop executing.</description>
      <pubDate>Tue, 16 Oct 2007 15:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5086#M2059</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-16T15:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically repeat observations</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5087#M2060</link>
      <description>have you tried this?&lt;BR /&gt;
&lt;BR /&gt;
data two (drop=i);&lt;BR /&gt;
  set one;&lt;BR /&gt;
  do i = 1 to num;&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 16 Oct 2007 16:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5087#M2060</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-16T16:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically repeat observations</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5088#M2061</link>
      <description>Works like a charm.&lt;BR /&gt;
Thanks.</description>
      <pubDate>Tue, 16 Oct 2007 17:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamically-repeat-observations/m-p/5088#M2061</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-16T17:06:15Z</dc:date>
    </item>
  </channel>
</rss>

