<?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 not to read what is stated in a delimiter in a character variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714978#M220793</link>
    <description>data sample;&lt;BR /&gt;infile datalines truncover dlmstr=' ' dsd;&lt;BR /&gt;input Size dirname $1000.;&lt;BR /&gt;datalines;&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Folder with Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;;&lt;BR /&gt;run;</description>
    <pubDate>Thu, 28 Jan 2021 13:33:11 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-01-28T13:33:11Z</dc:date>
    <item>
      <title>How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714942#M220778</link>
      <description>&lt;P&gt;Below is the program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sample;&lt;BR /&gt;infile datalines truncover dlmstr=' ' dsd;&lt;BR /&gt;length Size dirname $1000;&lt;BR /&gt;input Size dirname $;&lt;BR /&gt;datalines;&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Folder with Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem: Since there is a ' ' in variable dirname, what will only be read are those before ' '. Is there a way to fix this? What I want is for dirname to read even ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 11:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714942#M220778</guid>
      <dc:creator>iSAS</dc:creator>
      <dc:date>2021-01-28T11:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714945#M220779</link>
      <description>&lt;P&gt;Read size as a number, and use the &amp;amp;&amp;amp; modifier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
infile datalines truncover dlmstr=' ' dsd;
length Size 8 dirname $1000;
input Size dirname &amp;amp;&amp;amp;:$1000.;
datalines;
21561 /Folder_no_space/Folder_no_space/Folder with Space/Folder_no_space/file.sas7bdat
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jan 2021 11:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714945#M220779</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-28T11:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714954#M220784</link>
      <description>Thank you for helping. I just have a follow-up question though. How come if my variable dirname have more than 2 spaces, it doesn't read all of it anymore? Below is the code:&lt;BR /&gt;&lt;BR /&gt;data sample;&lt;BR /&gt;infile datalines truncover dlmstr=' ' dsd;&lt;BR /&gt;length Size 8 dirname $1000;&lt;BR /&gt;input Size dirname &amp;amp;&amp;amp;:$1000.;&lt;BR /&gt;datalines;&lt;BR /&gt;21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Two Spaces/Folder_no_space/file.sas7bdat&lt;BR /&gt;21562 /Folder_no_space/Folder_no_space/More Spaces/Folder_no_space/file.sas7bdat&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;May I know how to fix it? Thanks</description>
      <pubDate>Thu, 28 Jan 2021 12:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714954#M220784</guid>
      <dc:creator>iSAS</dc:creator>
      <dc:date>2021-01-28T12:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714956#M220785</link>
      <description>&lt;P&gt;I see no problem:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
infile datalines truncover dlmstr=' ' dsd;
length Size 8 dirname $1000;
input Size dirname &amp;amp;&amp;amp;:$1000.;
datalines;
21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat
21561 /Folder_no_space/Folder_no_space/Two Spaces/Folder_no_space/file.sas7bdat
21562 /Folder_no_space/Folder_no_space/More Spaces/Folder_no_space/file.sas7bdat
;

proc print data=sample noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;Size	dirname
21560	/Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat
21561	/Folder_no_space/Folder_no_space/Two Spaces/Folder_no_space/file.sas7bdat
21562	/Folder_no_space/Folder_no_space/More Spaces/Folder_no_space/file.sas7bdat
&lt;/PRE&gt;
&lt;P&gt;Please use the "little running man" button for posting code, as the main posting window will reformat your text along HTML conventions (compressing all whitespace to a single blank, for instance).&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 12:20:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714956#M220785</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-28T12:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714961#M220786</link>
      <description>&lt;P&gt;Sending the code the have issues when dirname has more then 1 space:&lt;BR /&gt;data sample;&lt;BR /&gt;infile datalines truncover dlmstr=' ' dsd;&lt;BR /&gt;length Size 8 dirname $1000;&lt;BR /&gt;input Size dirname &amp;amp;&amp;amp;:$1000.;&lt;BR /&gt;datalines;&lt;BR /&gt;21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Two&amp;nbsp; Spaces/Folder_no_space/file.sas7bdat&lt;BR /&gt;21562 /Folder_no_space/Folder_no_space/More&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Spaces/Folder_no_space/file.sas7bdat&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Result:&lt;BR /&gt;21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Two&lt;BR /&gt;21562 /Folder_no_space/Folder_no_space/More&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 12:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714961#M220786</guid>
      <dc:creator>iSAS</dc:creator>
      <dc:date>2021-01-28T12:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714964#M220787</link>
      <description>&lt;P&gt;Then you need to have quotes around the strings, or use a delimiter other than blank. The ?? works only as long as single blanks are contained in the strings.&lt;/P&gt;
&lt;P&gt;And use the "little running man" button for posting code, it is the one right next to the one indicated (which is for logs and other formatted text data):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/710AFAD0E2288E4865F0ACA859F48344/responsive_peak/images/image_not_found.png" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 12:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714964#M220787</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-28T12:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714973#M220790</link>
      <description>&lt;P&gt;Here's a promising approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
infile datalines truncover dlmstr=' ' dsd;
length Size 8 dirname $1000;
input Size @;
dirname = substr(_infile_, 7);
datalines;
21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat
21561 /Folder_no_space/Folder_no_space/Two  Spaces/Folder_no_space/file.sas7bdat
21562 /Folder_no_space/Folder_no_space/More                                     Spaces/Folder_no_space/file.sas7bdat
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even if your real life situation is more complex, these tools should be adaptable to what you are facing.&amp;nbsp; For example, you may need to locate the position of ".sas7bdat" in order to limit what SUBSTR selects.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 13:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714973#M220790</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-01-28T13:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714978#M220793</link>
      <description>data sample;&lt;BR /&gt;infile datalines truncover dlmstr=' ' dsd;&lt;BR /&gt;input Size dirname $1000.;&lt;BR /&gt;datalines;&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Folder with Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 28 Jan 2021 13:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714978#M220793</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-28T13:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714979#M220794</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132557"&gt;@iSAS&lt;/a&gt;&amp;nbsp; just an in-formatted input should do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data sample;
infile datalines truncover ;
input Size dirname $1000.;
datalines;
21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat
21561 /Folder_no_space/Folder_no_space/Two Spaces/Folder_no_space/file.sas7bdat
21562 /Folder_no_space/Folder_no_space/More Spaces/Folder_no_space/file.sas7bdat
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jan 2021 13:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/714979#M220794</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-28T13:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: How not to read what is stated in a delimiter in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/715020#M220818</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132557"&gt;@iSAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you for helping. I just have a follow-up question though. How come if my variable dirname have more than 2 spaces, it doesn't read all of it anymore? Below is the code:&lt;BR /&gt;&lt;BR /&gt;data sample;&lt;BR /&gt;infile datalines truncover dlmstr=' ' dsd;&lt;BR /&gt;length Size 8 dirname $1000;&lt;BR /&gt;input Size dirname &amp;amp;&amp;amp;:$1000.;&lt;BR /&gt;datalines;&lt;BR /&gt;21560 /Folder_no_space/Folder_no_space/One Space/Folder_no_space/file.sas7bdat&lt;BR /&gt;21561 /Folder_no_space/Folder_no_space/Two Spaces/Folder_no_space/file.sas7bdat&lt;BR /&gt;21562 /Folder_no_space/Folder_no_space/More Spaces/Folder_no_space/file.sas7bdat&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;May I know how to fix it? Thanks&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;From the documentation on INFILE DSD option:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-syntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-otherArgGroup"&gt;
&lt;DIV id="n0fa7kq7teis7cn0znh84wga9e0t" class="xis-argDescriptionPair"&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;When you specify DSD, SAS treats two consecutive delimiters as a missing value&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So if your character value has two blanks you tell SAS that you have ended the first value by including them.&lt;/P&gt;
&lt;P&gt;If you must use spaces in the values then you need to find either a better delimiter or change how you read the data, perhaps fixed columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 15:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-not-to-read-what-is-stated-in-a-delimiter-in-a-character/m-p/715020#M220818</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-28T15:17:24Z</dc:date>
    </item>
  </channel>
</rss>

