<?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: Need to create obs based on two columns start and end in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721748#M223739</link>
    <description>Works like a charm, thank you!</description>
    <pubDate>Thu, 25 Feb 2021 03:02:07 GMT</pubDate>
    <dc:creator>Fettah</dc:creator>
    <dc:date>2021-02-25T03:02:07Z</dc:date>
    <item>
      <title>Need to create obs based on two columns start and end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721733#M223731</link>
      <description>&lt;P&gt;Can you please advice how I might create observations containing a range of values, where the range is specified by two columns: start, and end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Essentially, how do I convert this:&lt;/P&gt;
&lt;PRE&gt;data have;
input start end;
datalines;
100 103
301 305
336 338
;&lt;/PRE&gt;
&lt;P&gt;to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
input start end num;
datalines;
100 120 100
100 120 101
100 120 102
301 305 301
301 305 302
301 305 303
301 305 304
301 305 305
336 338 336
336 338 337
336 338 338 
;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 02:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721733#M223731</guid>
      <dc:creator>Fettah</dc:creator>
      <dc:date>2021-02-25T02:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create obs based on two columns start and end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721740#M223734</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
  set have;
  do num=start to end;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;try this code.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 02:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721740#M223734</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-02-25T02:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create obs based on two columns start and end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721741#M223735</link>
      <description>&lt;P&gt;So, how does "end" get transformed to 120, 305 and 338 in that output?&lt;/P&gt;
&lt;P&gt;And are you sure that you don't want a&lt;/P&gt;
&lt;PRE&gt;100 120 103&lt;/PRE&gt;
&lt;P&gt;in the output as well? &lt;/P&gt;
&lt;P&gt;Without changing the "end" which you did not provide any logic for this is the basic approach&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   do num=start to end;
      output;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;The explicit OUTPUT statement means that data is written into the output data set each time it executes, once for each value in the Do loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 02:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721741#M223735</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-25T02:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create obs based on two columns start and end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721747#M223738</link>
      <description>&lt;P&gt;Woops. that was a typo. Thanks for pointing it out.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 03:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721747#M223738</guid>
      <dc:creator>Fettah</dc:creator>
      <dc:date>2021-02-25T03:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create obs based on two columns start and end</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721748#M223739</link>
      <description>Works like a charm, thank you!</description>
      <pubDate>Thu, 25 Feb 2021 03:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-obs-based-on-two-columns-start-and-end/m-p/721748#M223739</guid>
      <dc:creator>Fettah</dc:creator>
      <dc:date>2021-02-25T03:02:07Z</dc:date>
    </item>
  </channel>
</rss>

