<?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: How do I read in a .txt file with double quotes without splitting up multi-word names? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455042#M284253</link>
    <description>&lt;P&gt;And here a more specific version, with my ideas for variable types/lengths:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile cards dlm=' ' dsd firstobs=2;
length
  ID $3
  Radon 8
  Floor 3
  Uranium 8
  County $2
  countyname $ 40
;
input ID Radon Floor Uranium County countyname;
cards;
"log.radon" "floor" "uranium" "county" "county.name"
"1" "0.78845736036427" "1" "-0.6890475953545" "1" "AITKIN "
"2" "0.78845736036427" "0" "-0.6890475953545" "1" "AITKIN "
"3" "1.06471073699243" "0" "-0.6890475953545" "1" "AITKIN "
"917" "1.6094379124341" "0" "-0.0900242748478867" "84" "WRIGHT "
"918" "1.30833281965018" "0" "0.355286981163884" "85" "YELLOW MEDICINE "
"919" "1.06471073699243" "0" "0.355286981163884" "85" "YELLOW MEDICINE "
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that your initial code would read all variables as $40.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2018 06:33:37 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-04-18T06:33:37Z</dc:date>
    <item>
      <title>How do I read in a .txt file with double quotes without splitting up multi-word names?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455037#M284251</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to read this dataset into SAS Studio (Release: 3.71 - Basic Edition). As shown below, everything is in double quotes:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"log.radon" "floor" "uranium" "county" "county.name"&lt;BR /&gt;"1" "0.78845736036427" "1" "-0.6890475953545" "1" "AITKIN "&lt;BR /&gt;"2" "0.78845736036427" "0" "-0.6890475953545" "1" "AITKIN "&lt;BR /&gt;"3" "1.06471073699243" "0" "-0.6890475953545" "1" "AITKIN "&lt;/P&gt;&lt;P&gt;(more lines of data here)&lt;/P&gt;&lt;P&gt;"917" "1.6094379124341" "0" "-0.0900242748478867" "84" "WRIGHT "&lt;BR /&gt;"918" "1.30833281965018" "0" "0.355286981163884" "85" "YELLOW MEDICINE "&lt;BR /&gt;"919" "1.06471073699243" "0" "0.355286981163884" "85" "YELLOW MEDICINE "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data temp;&lt;BR /&gt; length ID Radon Floor Uranium County countyname $ 40;&lt;BR /&gt; infile "&amp;amp;path/radon.MN.txt" dlm='" "' firstobs=2; &lt;BR /&gt; input ID Radon Floor Uranium County countyname$;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;DIV class="sasError"&gt;&lt;P&gt;All of my numeric variables read in perfectly, but my one character variable will read in only the first word.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, obs 919's county.name is "YELLOW MEDICINE" but I the output just says YELLOW.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS help.JPG" style="width: 582px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19900i5C21AE721BB9CB26/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS help.JPG" alt="SAS help.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;&lt;P&gt;Because SAS stops after it reaches the first space between words and moves the next word to a new variable, I am guessing it's a problem with how I'm setting up dlm.&amp;nbsp; How can I prevent this miscommunication with SAS so that it reads in everything between double quotes and not just the first word?&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;Note: I've tried dsd but the error message seems to say that won't work with this file.&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;"ERROR: Quotes (' or ") have been detected in the delimiter (DLM=)&lt;/DIV&gt;&lt;DIV class="sasError"&gt;string. Quotes cannot be used as delimiter characters when the&lt;/DIV&gt;&lt;DIV class="sasError"&gt;DSD option is also specified."&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I apologize for anything in this post that I've formatted poorly or vaguely. I appreciate any formatting feedback, too.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any thoughts or suggestions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nicole&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 06:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455037#M284251</guid>
      <dc:creator>nzelinsky</dc:creator>
      <dc:date>2018-04-18T06:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read in a .txt file with double quotes without splitting up multi-word names?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455040#M284252</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
 length ID Radon Floor Uranium County countyname $ 40;
 infile "&amp;amp;path/radon.MN.txt" dlm=' ' dsd firstobs=2; 
 input ID Radon Floor Uranium County countyname$;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Apr 2018 06:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455040#M284252</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T06:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read in a .txt file with double quotes without splitting up multi-word names?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455042#M284253</link>
      <description>&lt;P&gt;And here a more specific version, with my ideas for variable types/lengths:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile cards dlm=' ' dsd firstobs=2;
length
  ID $3
  Radon 8
  Floor 3
  Uranium 8
  County $2
  countyname $ 40
;
input ID Radon Floor Uranium County countyname;
cards;
"log.radon" "floor" "uranium" "county" "county.name"
"1" "0.78845736036427" "1" "-0.6890475953545" "1" "AITKIN "
"2" "0.78845736036427" "0" "-0.6890475953545" "1" "AITKIN "
"3" "1.06471073699243" "0" "-0.6890475953545" "1" "AITKIN "
"917" "1.6094379124341" "0" "-0.0900242748478867" "84" "WRIGHT "
"918" "1.30833281965018" "0" "0.355286981163884" "85" "YELLOW MEDICINE "
"919" "1.06471073699243" "0" "0.355286981163884" "85" "YELLOW MEDICINE "
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that your initial code would read all variables as $40.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 06:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-read-in-a-txt-file-with-double-quotes-without-splitting/m-p/455042#M284253</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T06:33:37Z</dc:date>
    </item>
  </channel>
</rss>

