<?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: Creating Multiple Observations from an Observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587502#M167818</link>
    <description>&lt;P&gt;Ah yes, sorry. A bit more complicated, but gets the job done&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input week item store price;
datalines;
1166 23 100 1.50 
1166 23 200 2.50 
1166 23 250 2.50 
1166 25 110 3.25 
1166 25 120 4.50 
1167 23 100 1.50 
1167 23 200 2.50 
1167 23 250 2.50 
1167 25 110 3.25 
1167 25 120 4.50 
;

data want(drop=i j k);
    format week item store store1 price;
    do _n_=1 by 1 until (last.item);
        set have;
        by week item;
        _iorc_+1;
    end;

    i=_iorc_-(_n_-1);

    do j=1 to _n_;
        set have(rename=store=store1);
        do k=i to _iorc_;
            set have point=k;
            output;
        end;    
    end;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 13:35:13 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-09-10T13:35:13Z</dc:date>
    <item>
      <title>Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587481#M167807</link>
      <description>&lt;P&gt;Hi SAS Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to ask how to create multiple copy of observations from a single observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the moment, I have the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;WEEK&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;ITEM&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;STORE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;PRICE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;110&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;3.25&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;120&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;4.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to have the following:&lt;/P&gt;
&lt;TABLE style="height: 300px;"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;WEEK&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;ITEM&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;STORE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;STORE1&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;PRICE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;…&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;110&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;110&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;3.25&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;120&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;110&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;4.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;110&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;120&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;3.25&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;25&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;120&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;120&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;4.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This analysis is in terms of &lt;STRONG&gt;WEEK&lt;/STRONG&gt; and &lt;STRONG&gt;ITEM&lt;/STRONG&gt;. In the first case, there are 3 observations in WEEK 1166 and ITEM 23. Hence, I want to copy the exact observation by store. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587481#M167807</guid>
      <dc:creator>DavidLie</dc:creator>
      <dc:date>2019-09-10T12:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587483#M167808</link>
      <description>&lt;P&gt;I don't understand the logic by which you go from your original data set to the data set you want. Can you explain it in detail? Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post data following these instructions so we have an actual SAS data set to work with:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587483#M167808</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-10T12:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587485#M167810</link>
      <description>&lt;P&gt;I think this is what you want..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input week item store price;
datalines;
1166 23 100 1.50 
1166 23 200 2.50 
1166 23 250 2.50 
1166 25 110 3.25 
1166 25 120 4.50 
;

data want(drop=i j);
    do _N_=1 by 1 until (last.item);
        set have;
        by item;
    end;
    do i=1 to _N_;
        do j=1 to _N_;
            set have point=j;
            output;
        end;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587485#M167810</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-10T12:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587487#M167811</link>
      <description>&lt;P&gt;Hi Draycut,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your message. Yes, this is close to something that I want. But:&lt;/P&gt;
&lt;P&gt;1. When I tried it in my SAS, item 25 is somehow replaced by item 23.&lt;/P&gt;
&lt;P&gt;2. I need to have an entry of STORE1 as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder if that can be doable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best,&lt;BR /&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587487#M167811</guid>
      <dc:creator>DavidLie</dc:creator>
      <dc:date>2019-09-10T12:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587489#M167812</link>
      <description>&lt;P&gt;Hi Paige,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your email. In this case, I want to create exact copies of my current observation by ITEM and WEEK. For example, in the WEEK 1166 and ITEM 23, there are 3 stores (namely Store 100, Store 200 and Store 250).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create exact entries of these 3 stores to capture the interactions. For example:&lt;/P&gt;
&lt;P&gt;Store 100 and Store 100;&lt;/P&gt;
&lt;P&gt;Store 100 and Store 200;&lt;/P&gt;
&lt;P&gt;Store 100 and Store 250:&lt;/P&gt;
&lt;P&gt;Store 200 and Store 100;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;Store 250 and Store 250.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a result, I have to inflate my dataset of having the same observations from 3 to 9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 300px;"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;WEEK&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;ITEM&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;STORE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;STORE1&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;&lt;STRONG&gt;PRICE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 20px;"&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;250&lt;/P&gt;
&lt;/TD&gt;
&lt;TD style="height: 20px; width: 120px;"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope I make myself clearer now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587489#M167812</guid>
      <dc:creator>DavidLie</dc:creator>
      <dc:date>2019-09-10T12:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587490#M167813</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25583"&gt;@DavidLie&lt;/a&gt;&amp;nbsp;My share of fun with your STORE1 I think&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input WEEK	ITEM	STORE	PRICE;
cards;
1166	23	100	1.5
1166	23	200	2.5
1166	23	250	2.5
1166	25	110	3.25
1166	25	120	4.5
;

data want;
 if _n_=1 then do;
   dcl hash H (ordered: "A") ;
   h.definekey  ("_n_") ;
   h.definedata ("WEEK","ITEM","STORE","PRICE") ;
   h.definedone () ;
   dcl hiter hi('h');
end;
do _n_=1 by 1 until(last.item);
 set have;
 by WEEK	ITEM;
 array t(999999)_temporary_;
 if _n_=1 then store1=store;
 else t(_n_)=store;
 output;
 _rc=h.add();
end;
do _n_=2 to _n_;
 do while(hi.next()=0);
 store1=t(_n_);
  output;
 end;
end;
h.clear();
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 12:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587490#M167813</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-10T12:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587491#M167814</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25583"&gt;@DavidLie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi SAS Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to ask how to create multiple copy of observations from a single observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the moment, I have the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;WEEK&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;ITEM&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;STORE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;&lt;STRONG&gt;PRICE&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;100&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;
&lt;P&gt;1166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;23&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;200&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="120"&gt;
&lt;P&gt;2.50&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="120"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So the price from STORE 200 is 2.50 and then when you create the row in the output with WEEK 1166 and ITEM 23 and STORE 200, this price of 2.50 overwrites the 1.50 that was in the original table. Is that correct?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587491#M167814</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-10T13:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587500#M167817</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input week item store price;
datalines;
1166 23 100 1.50 
1166 23 200 2.50 
1166 23 250 2.50 
1166 25 110 3.25 
1166 25 120 4.50 
;
proc sql;
create table temp as
select distinct item,store from have;

create table want as
 select a.*,b.store2
  from have as a,temp(rename=(store=store2)) as b
   where a.item=b.item
    order by a.item,store2,store;
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587500#M167817</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-10T13:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587502#M167818</link>
      <description>&lt;P&gt;Ah yes, sorry. A bit more complicated, but gets the job done&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input week item store price;
datalines;
1166 23 100 1.50 
1166 23 200 2.50 
1166 23 250 2.50 
1166 25 110 3.25 
1166 25 120 4.50 
1167 23 100 1.50 
1167 23 200 2.50 
1167 23 250 2.50 
1167 25 110 3.25 
1167 25 120 4.50 
;

data want(drop=i j k);
    format week item store store1 price;
    do _n_=1 by 1 until (last.item);
        set have;
        by week item;
        _iorc_+1;
    end;

    i=_iorc_-(_n_-1);

    do j=1 to _n_;
        set have(rename=store=store1);
        do k=i to _iorc_;
            set have point=k;
            output;
        end;    
    end;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587502#M167818</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-10T13:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587507#M167819</link>
      <description>&lt;P&gt;Having spent more time examining the problem and the explanation from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25583"&gt;@DavidLie&lt;/a&gt;, I was thinking the solution is something called a Cartesian Join, but since both&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;have provided two different ways to do a Cartesian Join, I won't bother adding mine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I point out that in PROC SQL, you get a Cartesian Join by using a comma between data sets (instead of some JOIN operator) and by not using the ON clause.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587507#M167819</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-10T13:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587509#M167820</link>
      <description>Thanks all for helping me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Greatly appreciated.</description>
      <pubDate>Tue, 10 Sep 2019 13:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587509#M167820</guid>
      <dc:creator>DavidLie</dc:creator>
      <dc:date>2019-09-10T13:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Multiple Observations from an Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587510#M167821</link>
      <description>&lt;P&gt;Anytime, glad to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-Multiple-Observations-from-an-Observation/m-p/587510#M167821</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-10T13:35:38Z</dc:date>
    </item>
  </channel>
</rss>

