<?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: Create Columns from text in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629919#M20786</link>
    <description>&lt;P&gt;I had effectively the same approach as above, but I would probably nest all the position information unless you need to save that information. The ones below should work as long as the data you have follows the style shown in your original post. I did use two steps for Exchange Rate so that the code wasn't as wide when posting it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;grade = scan(substr(narration, index(narration,'Grade:')+6),1,'"');
invoice = scan(substr(narration, index(narration,'No.')+3),1,' ');
qty = input(scan(substr(narration, index(narration,'Qty.')+4),1,' '),best12.);
Amount = scan(substr(narration,index(narration,'$')),1,' ');
_ER = scan(substr(narration, index(narration,'Rate')+4),1,':');
ExchRate = substr(_ER,1,length(_ER)-1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Mar 2020 19:02:48 GMT</pubDate>
    <dc:creator>Duggins</dc:creator>
    <dc:date>2020-03-05T19:02:48Z</dc:date>
    <item>
      <title>Create Columns from text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629806#M20780</link>
      <description>&lt;P&gt;I have a dataset in which I am trying to create multiple columns from one column basis on text for eg:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Address&lt;/TD&gt;&lt;TD&gt;Vch Type&lt;/TD&gt;&lt;TD&gt;Vch No.&lt;/TD&gt;&lt;TD&gt;Debit&lt;/TD&gt;&lt;TD&gt;Narration&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03.04.2019&lt;/TD&gt;&lt;TD&gt;Hasan pvt ltd&lt;/TD&gt;&lt;TD&gt;Plot no 05, Tilak road New delhi, Delhi&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;BPL/AT/001&lt;/TD&gt;&lt;TD&gt;2336374.00&lt;/TD&gt;&lt;TD&gt;Being the Sale of Cut Ornge Grade:"APTC/I/66" Blend Cut apple vide Invoice No.BPL/CT/001/2019-20 Dt.03.04.2019 - Qty.12430 Kgs for - $.34182.50.00 Exch.Rate:Rs.68.35.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03.04.2019&lt;/TD&gt;&lt;TD&gt;Indra pvt ltd&lt;/TD&gt;&lt;TD&gt;112, Nelson road, Delhi&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;BPL/OT/002&lt;/TD&gt;&lt;TD&gt;3336374.00&lt;/TD&gt;&lt;TD&gt;Being the Sale of Cut Apple Grade:"ORTC/I/66" Blend Cut apple vide Invoice No.BPL/CT/001/2019-20 Dt.03.04.2019 - Qty.12430 Kgs for - $.34182.50.00 Exch.Rate:Rs.68.35.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03.04.2019&lt;/TD&gt;&lt;TD&gt;Middle Venture&lt;/TD&gt;&lt;TD&gt;5th Floor, Tamouh Tower, Marina Square, Al Reem Island Abu Dhabi&amp;nbsp;United Arab Emirate&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;BPL/PT/003&lt;/TD&gt;&lt;TD&gt;2436375.00&lt;/TD&gt;&lt;TD&gt;Being the Sale of Cut Pineapple Grade:"PATC/I/66" Blend Cut apple vide Invoice No.BPL/CT/001/2019-20 Dt.03.04.2019 - Qty.12430 Kgs for - $.34182.50.00 Exch.Rate:Rs.68.35.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now on the basis of narration I am trying to create new column for eg:-&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Address&lt;/TD&gt;&lt;TD&gt;Vch_Type&lt;/TD&gt;&lt;TD&gt;Vch_No&lt;/TD&gt;&lt;TD&gt;Debit&lt;/TD&gt;&lt;TD&gt;Narration&lt;/TD&gt;&lt;TD&gt;Grade&lt;/TD&gt;&lt;TD&gt;Invoice&lt;/TD&gt;&lt;TD&gt;qty&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Amount&lt;/TD&gt;&lt;TD&gt;Exch_Rate&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03.04.2019&lt;/TD&gt;&lt;TD&gt;Hasan pvt ltd&lt;/TD&gt;&lt;TD&gt;Plot no 05, Tilak road New delhi, Delhi&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;BPL/AT/001&lt;/TD&gt;&lt;TD&gt;2336374.00&lt;/TD&gt;&lt;TD&gt;Being the Sale of Cut Ornge Grade:"APTC/I/66" Blend Cut apple vide Invoice No.BPL/CT/001/2019-20 Dt.03.04.2019 - Qty.12430 Kgs for - $.34182.50.00 Exch.Rate:Rs.68.35.&lt;/TD&gt;&lt;TD&gt;APTC/I/66&lt;/TD&gt;&lt;TD&gt;BPL/CA/001/2019-20&lt;/TD&gt;&lt;TD&gt;12430 Kgs&lt;/TD&gt;&lt;TD&gt;$.34182.50.00&lt;/TD&gt;&lt;TD&gt;Rs.68.35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03.04.2019&lt;/TD&gt;&lt;TD&gt;Indra pvt ltd&lt;/TD&gt;&lt;TD&gt;112, Nelson road, Delhi&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;BPL/OT/002&lt;/TD&gt;&lt;TD&gt;3336374.00&lt;/TD&gt;&lt;TD&gt;Being the Sale of Cut Apple Grade:"ORTC/I/66" Blend Cut apple vide Invoice No.BPL/CT/001/2019-20 Dt.03.04.2019 - Qty.12430 Kgs for - $.34182.50.00 Exch.Rate:Rs.68.35.&lt;/TD&gt;&lt;TD&gt;ORTC/I/66&lt;/TD&gt;&lt;TD&gt;BPL/CO/001/2019-20&lt;/TD&gt;&lt;TD&gt;12430 Kgs&lt;/TD&gt;&lt;TD&gt;$.34182.50.00&lt;/TD&gt;&lt;TD&gt;Rs.68.35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03.04.2019&lt;/TD&gt;&lt;TD&gt;Middle Venture&lt;/TD&gt;&lt;TD&gt;5th Floor, Tamouh Tower, Marina Square, Al Reem Island Abu Dhabi&amp;nbsp;United Arab Emirate&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;BPL/PT/003&lt;/TD&gt;&lt;TD&gt;2436375.00&lt;/TD&gt;&lt;TD&gt;Being the Sale of Cut Pineapple Grade:"PATC/I/66" Blend Cut apple vide Invoice No.BPL/CT/001/2019-20 Dt.03.04.2019 - Qty.12430 Kgs for - $.34182.50.00 Exch.Rate:Rs.68.35.&lt;/TD&gt;&lt;TD&gt;PATC/I/66&lt;/TD&gt;&lt;TD&gt;BPL/CP/001/2019-20&lt;/TD&gt;&lt;TD&gt;12430 Kgs&lt;/TD&gt;&lt;TD&gt;$.34182.50.00&lt;/TD&gt;&lt;TD&gt;Rs.68.35&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using substr and scan function but it not giving me the result because words count and delimiter's are not same&lt;/P&gt;&lt;P&gt;Please help me on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 14:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629806#M20780</guid>
      <dc:creator>umeshgiri48</dc:creator>
      <dc:date>2020-03-05T14:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create Columns from text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629836#M20784</link>
      <description>&lt;P&gt;Find where the text Grade: is in the variable called Narration, then take the next word where the delimiters are double quotes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where = findw(narration,'Grade:');
grade = scan(substr(narration,where+6),1,'"');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 15:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629836#M20784</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-05T15:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create Columns from text</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629919#M20786</link>
      <description>&lt;P&gt;I had effectively the same approach as above, but I would probably nest all the position information unless you need to save that information. The ones below should work as long as the data you have follows the style shown in your original post. I did use two steps for Exchange Rate so that the code wasn't as wide when posting it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;grade = scan(substr(narration, index(narration,'Grade:')+6),1,'"');
invoice = scan(substr(narration, index(narration,'No.')+3),1,' ');
qty = input(scan(substr(narration, index(narration,'Qty.')+4),1,' '),best12.);
Amount = scan(substr(narration,index(narration,'$')),1,' ');
_ER = scan(substr(narration, index(narration,'Rate')+4),1,':');
ExchRate = substr(_ER,1,length(_ER)-1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2020 19:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-Columns-from-text/m-p/629919#M20786</guid>
      <dc:creator>Duggins</dc:creator>
      <dc:date>2020-03-05T19:02:48Z</dc:date>
    </item>
  </channel>
</rss>

