<?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 Help - Splitting a data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152188#M29969</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am hoping for some help with parsing a string in a data set to create a one-many relationship.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have: A data set with two variables/fields.&amp;nbsp; 1 containing an Order_Number, the other containing Order_notes / user input free flow text &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Number&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Notes&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;14-07-05[userid1] Note1&lt;BR /&gt;14-07-05[userid2] Note2&lt;/P&gt;&lt;P&gt;14-07-05[userid3] Note3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need: A similiar data set, but with the User_Notes parsed into individual records:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Number&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Notes&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14-07-05[userid1] Note1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14-07-05[userid2] Note2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14-07-05[userid3] Note3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously, my dataset is much larger, and the number of Order_Notes for each Order_Number is dynamic.&amp;nbsp; Also, the length of the UserID is variable.&amp;nbsp; However, each user note is seperated by a carriage return inside the Order_Notes.&amp;nbsp; Any help is very greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Cory&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Aug 2014 17:53:29 GMT</pubDate>
    <dc:creator>cdvander</dc:creator>
    <dc:date>2014-08-06T17:53:29Z</dc:date>
    <item>
      <title>Help - Splitting a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152188#M29969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am hoping for some help with parsing a string in a data set to create a one-many relationship.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have: A data set with two variables/fields.&amp;nbsp; 1 containing an Order_Number, the other containing Order_notes / user input free flow text &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Number&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Notes&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;14-07-05[userid1] Note1&lt;BR /&gt;14-07-05[userid2] Note2&lt;/P&gt;&lt;P&gt;14-07-05[userid3] Note3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need: A similiar data set, but with the User_Notes parsed into individual records:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Number&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Order_Notes&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14-07-05[userid1] Note1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14-07-05[userid2] Note2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12345&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;14-07-05[userid3] Note3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously, my dataset is much larger, and the number of Order_Notes for each Order_Number is dynamic.&amp;nbsp; Also, the length of the UserID is variable.&amp;nbsp; However, each user note is seperated by a carriage return inside the Order_Notes.&amp;nbsp; Any help is very greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Cory&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 17:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152188#M29969</guid>
      <dc:creator>cdvander</dc:creator>
      <dc:date>2014-08-06T17:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help - Splitting a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152189#M29970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You'll need to determine the hex code that represents a carriage return, but then it becomes pretty easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; length just_1_note $ 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do i=1 to 10000 until (just_1_note=' ');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; just_1_note = scan(order_notes, 'HC'x);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if just_1_note &amp;gt; ' ' then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; keep order_number just_1_note;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rename just_1_note = order_notes;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whatever the proper hex code is, replace HC with those characters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 18:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152189#M29970</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-08-06T18:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help - Splitting a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152190#M29971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Astounding,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANK YOU! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, would there be a way to do that same thing, only broken out with a regular expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 20:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152190#M29971</guid>
      <dc:creator>cdvander</dc:creator>
      <dc:date>2014-08-06T20:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help - Splitting a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152191#M29972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't say ... I don't know enough about regular expressions.&amp;nbsp; There are some on the board who do, but you would be more likely to get a reply if you post that as a separate question.&amp;nbsp; An old, answered question will soon be off the radar screens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2014 21:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152191#M29972</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-08-06T21:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help - Splitting a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152192#M29973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With regular expressions, it would be something like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data test;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;length Note $40;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if not prxID then prxID + prxparse("/.*/");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set myData;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;start = 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;stop = length(Order_Notes);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call prxnext(prxID, start, stop, Order_Notes, position, length);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;do while (position &amp;gt; 0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note = substr(Order_Notes, position, length);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start + 1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call prxnext(prxID, start, stop, Order_Notes, position, length);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;keep Order_Number Note;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print data=test noobs; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: within a regular expression the period (.) matches everything except a newline.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2014 02:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-Splitting-a-data-set/m-p/152192#M29973</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-08-07T02:23:47Z</dc:date>
    </item>
  </channel>
</rss>

