<?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: Parsing in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184505#M46929</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are problems with your code. You are missing a semi-colon on your set statement. You are re-writing the address field with your first scan statement, and the address variable shouldn't be in quotes. Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data work.report2_test;&lt;/P&gt;&lt;P&gt;SET work.REPORT1_TEST;&lt;/P&gt;&lt;P&gt;street=scan(Address,1, ",");&lt;/P&gt;&lt;P&gt;City=scan(Address,2, ",");&lt;/P&gt;&lt;P&gt;State=scan(Address,3, ",");&lt;/P&gt;&lt;P&gt;Zipcode=scan(Address,4, ",");&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Feb 2015 21:27:28 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2015-02-26T21:27:28Z</dc:date>
    <item>
      <title>Parsing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184502#M46926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would i parse this data: "2453 Clairmount St, Detroit, MI, 48206" and create 3 new variables Address, City, State and Zip code. The number of character in address and state is not consistent. I have to do this for a few hundred thousand rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Address&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;City&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;State&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Zip Code&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2453 Clairmount St&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Detroit&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt; MI&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;48206&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 20:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184502#M46926</guid>
      <dc:creator>gobejo</dc:creator>
      <dc:date>2015-02-26T20:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184503#M46927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the comma delimiters is consistent throughout the variables you can look into the scan function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;address=scan(variable, 1, ",");&lt;/P&gt;&lt;P&gt;city=scan(variable, 2, ",");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 20:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184503#M46927</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-26T20:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184504#M46928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did not communicate clearly. Sorry about that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am looking to create a new dataset from an existing data set which has 14 variables and 252 rows. &lt;/P&gt;&lt;P&gt;The existing data set has Address = 2453 Clairmount St, Detroit, MI, 48206 &lt;/P&gt;&lt;P&gt;I want the new dataset to have 18 rvariables (in which 14 are existing and 4 are created) and 252 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what i have written so far&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data work.report2_test;&lt;/P&gt;&lt;P&gt;SET work.REPORT1_TEST&lt;/P&gt;&lt;P&gt;Address=scan('Address',1, ",");&lt;/P&gt;&lt;P&gt;City=scan('Address',2, ",");&lt;/P&gt;&lt;P&gt;State=scan('Address',3, ",");&lt;/P&gt;&lt;P&gt;Zipcode=scan('Address',4, ",");&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but the out put i get is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 21:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184504#M46928</guid>
      <dc:creator>gobejo</dc:creator>
      <dc:date>2015-02-26T21:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184505#M46929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are problems with your code. You are missing a semi-colon on your set statement. You are re-writing the address field with your first scan statement, and the address variable shouldn't be in quotes. Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data work.report2_test;&lt;/P&gt;&lt;P&gt;SET work.REPORT1_TEST;&lt;/P&gt;&lt;P&gt;street=scan(Address,1, ",");&lt;/P&gt;&lt;P&gt;City=scan(Address,2, ",");&lt;/P&gt;&lt;P&gt;State=scan(Address,3, ",");&lt;/P&gt;&lt;P&gt;Zipcode=scan(Address,4, ",");&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 21:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Parsing/m-p/184505#M46929</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-26T21:27:28Z</dc:date>
    </item>
  </channel>
</rss>

