<?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 How do I read a raw data in multiple lines? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309878#M66774</link>
    <description>&lt;P&gt;Hi Community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about reading a specific type of raw data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose I have a data that looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;340 West 85th Street&lt;BR /&gt;New York NY 10024&lt;BR /&gt;40.79 -73.98&lt;BR /&gt;7901 Annapolis Road&lt;BR /&gt;Lanham MD 20706&lt;BR /&gt;38.95 -76.88&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want the 1st line to be an Address, 2nd line contains City (New York), State (NY), Zip (10024), and 3rd line contains Latitude(40.79) and Longitude (-73.98).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the code may look something like this (it is not correct):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input #1 Address $ 
#2 City $ State $ Zip
#3 Latitude Longitude;
datalines;
...;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Of course, this one does not work well. I am just wondering how to read a raw data like this (with multiple lines).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Nov 2016 21:20:09 GMT</pubDate>
    <dc:creator>Konsenlin</dc:creator>
    <dc:date>2016-11-07T21:20:09Z</dc:date>
    <item>
      <title>How do I read a raw data in multiple lines?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309878#M66774</link>
      <description>&lt;P&gt;Hi Community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about reading a specific type of raw data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose I have a data that looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;340 West 85th Street&lt;BR /&gt;New York NY 10024&lt;BR /&gt;40.79 -73.98&lt;BR /&gt;7901 Annapolis Road&lt;BR /&gt;Lanham MD 20706&lt;BR /&gt;38.95 -76.88&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want the 1st line to be an Address, 2nd line contains City (New York), State (NY), Zip (10024), and 3rd line contains Latitude(40.79) and Longitude (-73.98).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the code may look something like this (it is not correct):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
input #1 Address $ 
#2 City $ State $ Zip
#3 Latitude Longitude;
datalines;
...;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Of course, this one does not work well. I am just wondering how to read a raw data like this (with multiple lines).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309878#M66774</guid>
      <dc:creator>Konsenlin</dc:creator>
      <dc:date>2016-11-07T21:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read a raw data in multiple lines?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309884#M66777</link>
      <description>&lt;P&gt;&lt;CODE&gt;Hi Konsenlin,&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;you could write something like this as long as you make sure there are two blanks between the City and the state (to act as the delimiter of a multi-word-string).&lt;/P&gt;&lt;P&gt;I gave the city and address variable a size of 30&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data temp;
length address $30;
length city $30;
input #1 Address $
#2 City &amp;amp; $ State $ 2 Zip 5
#3 Latitude Longitude;
datalines;
...;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309884#M66777</guid>
      <dc:creator>jefreytag</dc:creator>
      <dc:date>2016-11-07T21:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read a raw data in multiple lines?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309889#M66780</link>
      <description>&lt;P&gt;The fact that there are multiple words per variable makes the processing a little tricky.&amp;nbsp; Here's one way to approach it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length address $ 50 city $ 30&amp;nbsp; state $ 2&amp;nbsp; zip $ 5&amp;nbsp; dummy $ 1;&lt;/P&gt;
&lt;P&gt;input dummy;&lt;/P&gt;
&lt;P&gt;address = _infile_;&lt;/P&gt;
&lt;P&gt;input dummy;&lt;/P&gt;
&lt;P&gt;zip = scan(_infile_, -1);&lt;/P&gt;
&lt;P&gt;state = scan(_infile_, -2);&lt;/P&gt;
&lt;P&gt;city = substr(_infile_, 1, length(_infile_)-9);&lt;/P&gt;
&lt;P&gt;input latitude longitude;&lt;/P&gt;
&lt;P&gt;drop dummy;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to inspect the zipcodes to make sure you don't have any longer values there.&amp;nbsp; Also note, it's better to make zipcode character instead of numeric so you won't have to worry about leading zeros.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-a-raw-data-in-multiple-lines/m-p/309889#M66780</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-07T22:02:19Z</dc:date>
    </item>
  </channel>
</rss>

