<?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: reading comma delimited text file into sas data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20635#M3232</link>
    <description>Not really, unless you are willing to read up the input data row and parse each field into a SAS variable using DATA step functions such as SCAN, SUBSTR, FIND and INDEX/INDEXW.  Still it will be a crap-shoot unless you know what to expect.  I'd agree that the input data-format is unreasonable and should be corrected to solve the problem, rather than "attempting" to address the symptom.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Fri, 17 Apr 2009 13:13:21 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-04-17T13:13:21Z</dc:date>
    <item>
      <title>reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20631#M3228</link>
      <description>Hi &lt;BR /&gt;
 any one can help me to sort out this problem.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
i have comma delimited text fie , inthat text file one variable values contains comma as a value. while i read that values it is giving data errors&lt;BR /&gt;
&lt;BR /&gt;
ex:&lt;BR /&gt;
id,name,location,salary&lt;BR /&gt;
101, john,newyork,usa,40000&lt;BR /&gt;
&lt;BR /&gt;
the text file data is like above.&lt;BR /&gt;
how can i convert text file into  datasets</description>
      <pubDate>Fri, 17 Apr 2009 07:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20631#M3228</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-17T07:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20632#M3229</link>
      <description>Get your supplier of the textfile to deliver all text with " - like this&lt;BR /&gt;
&lt;BR /&gt;
id,name,location,salary&lt;BR /&gt;
101, "john","newyork,usa",40000&lt;BR /&gt;
&lt;BR /&gt;
then you can use the infile dsd option.</description>
      <pubDate>Fri, 17 Apr 2009 08:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20632#M3229</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-04-17T08:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20633#M3230</link>
      <description>thank you for giving response.&lt;BR /&gt;
&lt;BR /&gt;
is there any alternate for this problem?.</description>
      <pubDate>Fri, 17 Apr 2009 08:12:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20633#M3230</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-17T08:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20634#M3231</link>
      <description>Not and easy one.  A CSV without quoted delimiters when they appear within a field is NOT a CSV file.  You could call it junk.&lt;BR /&gt;
&lt;BR /&gt;
It could be salvaged by counting delimiters if there is some pattern that can be recognized.&lt;BR /&gt;
&lt;BR /&gt;
you only show one line are they all like that or just a few?&lt;BR /&gt;
&lt;BR /&gt;
Show more data.</description>
      <pubDate>Fri, 17 Apr 2009 13:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20634#M3231</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-04-17T13:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20635#M3232</link>
      <description>Not really, unless you are willing to read up the input data row and parse each field into a SAS variable using DATA step functions such as SCAN, SUBSTR, FIND and INDEX/INDEXW.  Still it will be a crap-shoot unless you know what to expect.  I'd agree that the input data-format is unreasonable and should be corrected to solve the problem, rather than "attempting" to address the symptom.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 17 Apr 2009 13:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20635#M3232</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-17T13:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20636#M3233</link>
      <description>Sairam,&lt;BR /&gt;
&lt;BR /&gt;
after import the data use below code&lt;BR /&gt;
&lt;BR /&gt;
data infile (drop = location1 location2);&lt;BR /&gt;
set infile;&lt;BR /&gt;
location = trim(locatio1)||', '||location2;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Regards&lt;BR /&gt;
Alankar</description>
      <pubDate>Mon, 20 Apr 2009 02:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20636#M3233</guid>
      <dc:creator>Alankar</dc:creator>
      <dc:date>2009-04-20T02:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20637#M3234</link>
      <description>before following the above step, we should import location column as 2 variables (location1 &amp;amp; location2).</description>
      <pubDate>Mon, 20 Apr 2009 03:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20637#M3234</guid>
      <dc:creator>Alankar</dc:creator>
      <dc:date>2009-04-20T03:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20638#M3235</link>
      <description>Hi Alankar&lt;BR /&gt;
&lt;BR /&gt;
How would you handle a situation where you have the follwing data&lt;BR /&gt;
&lt;BR /&gt;
id,name,location,salary&lt;BR /&gt;
101, john,newyork,usa,40000&lt;BR /&gt;
101, john,newyork usa,40000&lt;BR /&gt;
101, john,10004,newyork,usa,40000&lt;BR /&gt;
&lt;BR /&gt;
If you use location = trim(locatio1)||', '||location2 ?</description>
      <pubDate>Mon, 20 Apr 2009 12:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20638#M3235</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-04-20T12:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: reading comma delimited text file into sas data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20639#M3236</link>
      <description>data in txt file is like this :&lt;BR /&gt;
&lt;BR /&gt;
id,name,location,salary&lt;BR /&gt;
101,john,newyork,usa,40000&lt;BR /&gt;
101,john,newyork,usa,40000&lt;BR /&gt;
101,john,newyork,usa,40000&lt;BR /&gt;
&lt;BR /&gt;
data import;&lt;BR /&gt;
infile "C:\Documents and Settings\am66635\Desktop\test.txt" &lt;BR /&gt;
dlm = "," firstobs = 2;&lt;BR /&gt;
input id $ name $ location1 $ location2 $ salary;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data import;&lt;BR /&gt;
infile "C:\Documents and Settings\am66635\Desktop\test.txt" &lt;BR /&gt;
dlm = "," firstobs = 2;&lt;BR /&gt;
input id $ name $ location1 $ location2 $ salary;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data clean (drop = location1 location2);&lt;BR /&gt;
set import;&lt;BR /&gt;
location = compress(location1||","||location2);&lt;BR /&gt;
/*location = trim(location1||","||location2);*/&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
This is based on my understanding.&lt;BR /&gt;
&lt;BR /&gt;
as you said if the data like following, it is difficult to import(3rd observation is different, right?).&lt;BR /&gt;
&lt;BR /&gt;
id,name,location,salary&lt;BR /&gt;
101,john,newyork,usa,40000&lt;BR /&gt;
101,john,newyork usa,40000&lt;BR /&gt;
101,john,10004,newyork,usa,40000</description>
      <pubDate>Tue, 28 Apr 2009 03:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-comma-delimited-text-file-into-sas-data-sets/m-p/20639#M3236</guid>
      <dc:creator>Alankar</dc:creator>
      <dc:date>2009-04-28T03:08:45Z</dc:date>
    </item>
  </channel>
</rss>

