<?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: Infile statement is converting .  (dot) to a blank and I need to preserve the . value. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676000#M203757</link>
    <description>Thank you, however, I&amp;nbsp;know that &amp;amp;file. is a macro variable. ( I should not have included the macro variable in the example)&lt;BR /&gt;I&amp;nbsp;am referring to the infile statement itself -- it &amp;nbsp;is converting var10 value &amp;nbsp;in to a blank when the value = .&amp;nbsp; and I need to retain the . (dot) because . is a valid value. I&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 11 Aug 2020 20:55:12 GMT</pubDate>
    <dc:creator>NJGIRL</dc:creator>
    <dc:date>2020-08-11T20:55:12Z</dc:date>
    <item>
      <title>Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/675993#M203751</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am looking or a sample infile statement that will read in a csv file&amp;nbsp;and preserve a value of . (dot)&amp;nbsp; NOT convert the . to&amp;nbsp;a blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; raw;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;infile&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#800080"&gt;"\\dfs\data\SAS\data\import\XXX\&amp;amp;file."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;dlm&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;';'&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;dsd&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;lrecl&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;32767&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;encoding&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=any &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;missover&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var1-var14 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$200.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var15 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$500.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var16-var19 &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;$200.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var1-var19 $;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 20:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/675993#M203751</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2020-08-11T20:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/675998#M203755</link>
      <description>&lt;P&gt;A dot denotes the end of a macro variable. Put two consecutive dots if you want a single dot to be retained.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 20:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/675998#M203755</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-08-11T20:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/675999#M203756</link>
      <description>&lt;P&gt;It isn't really clear if you mean the values of the variables or the name of the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would consider naming files with a . at the end to be a marginally poor practice. The dot typically is used as separator from an extension and if there is no extension in the file name then the proper reference is to not have .&lt;/P&gt;
&lt;P&gt;I hope you aren't getting confused about your actual file name because you have "show extenstions" turned off in any file manager program you use.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 20:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/675999#M203756</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-11T20:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676000#M203757</link>
      <description>Thank you, however, I&amp;nbsp;know that &amp;amp;file. is a macro variable. ( I should not have included the macro variable in the example)&lt;BR /&gt;I&amp;nbsp;am referring to the infile statement itself -- it &amp;nbsp;is converting var10 value &amp;nbsp;in to a blank when the value = .&amp;nbsp; and I need to retain the . (dot) because . is a valid value. I&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Aug 2020 20:55:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676000#M203757</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2020-08-11T20:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676003#M203760</link>
      <description>&lt;P&gt;oh gosh, I should not have included the infile macro file name in the post as it has nothing to do with the issue.. just to clarify, we don't have the file name ending in a dot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Just&amp;nbsp;for clarification, the preceding code is&lt;/P&gt;&lt;P&gt;/* Bring in External Data */&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; file = xxxx_Current.csv;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;sorry for the confusion. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Anyway, back to the issue --&amp;nbsp;Var10 has a . (dot) as a valid value in the csv file and I need to retain the . (. means a lab value is in normal range)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 21:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676003#M203760</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2020-08-11T21:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676006#M203762</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144583"&gt;@NJGIRL&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;oh gosh, I should not have included the infile macro file name in the post as it has nothing to do with the issue.. just to clarify, we don't have the file name ending in a dot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Just&amp;nbsp;for clarification, the preceding code is&lt;/P&gt;
&lt;P&gt;/* Bring in External Data */&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; file = xxxx_Current.csv;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;sorry for the confusion. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Anyway, back to the issue --&amp;nbsp;Var10 has a . (dot) as a valid value in the csv file and I need to retain the . (. means a lab value is in normal range)&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Custom informats can handle this though it may be inconvenient.&lt;/P&gt;
&lt;PRE&gt;proc format;
invalue $c_ (max=1000)
'.' = '.'
;

data example;
  infile datalines dlm=';';
  input x :$c_50.  y;
datalines4;
sometext;25
.;37
some much longer text to check if 50 is actually used;18
;;;;
&lt;/PRE&gt;
&lt;P&gt;I set the max length to this informat to 1000 characters, if you need it longer replace the MAX= value but there is still the single variable limit of 32767. Then specify the needed length as with the $ format but use $c_ (or pick another name in the format statement).&lt;/P&gt;
&lt;P&gt;The last line of example data will cut off the value at 50 characters per the informat so the 'sed' part of the text does not appear in variable X.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 21:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676006#M203762</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-11T21:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676021#M203775</link>
      <description>&lt;P&gt;It has nothing to do with the INFILE statement.&amp;nbsp; If you want SAS to interpret a single period as other than missing when reading character data then you need to use the $CHAR informat instead of the default $ informat.&amp;nbsp; Note that this will also preserve leading spaces, however DSD option should remove the leading spaces so you don't need to worry about that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data raw;
  infile "...."  dlm=';' dsd lrecl=32767 encoding=any truncover ;
  length var1-var14 $200 var15 $500 var16-var19 $200;
  input var1-var19 ;
  informat var1-var19 $char.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NOTES: Don't use INFORMAT (or FORMAT) to define the variables.&amp;nbsp; Instead actually tell SAS how you want them defined by using LENGTH (or ATTRIB) statement.&amp;nbsp; When using DSD you don't need to include a width on the INFORMAT (especially if you are not misusing the informat statement to define the variable) since when using list mode input the width of the informat is ignored.&amp;nbsp; TRUNCOVER is generally better than MISSOVER because of what happens to a value at the end of the line that is shorter than the informat width, but that doesn't make any difference when you list mode input (see early statement about ignoring informat width).&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2020 22:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676021#M203775</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-11T22:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676163#M203839</link>
      <description>Thank you Tom for your input (no pun intended:)&amp;nbsp; Yep, I do know the issue is not with the Infile stmt itself.&lt;BR /&gt;I will try the $CHAR format this morning, It is&amp;nbsp;very helpful that you provided code.&lt;BR /&gt;I like the idea of adding the length statement to datastep #1.BTW, here&amp;nbsp;is datastep #2. If you have any further comments, they are most welcome.&lt;BR /&gt;&lt;BR /&gt;data&amp;nbsp;XXX1&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; length study $11 barcode $10 yr_birth $11 gender fasting $1 parmcd $6 parmnm lbcat result $50 class $1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; range $30&amp;nbsp; lim_lo lim_hi $8 unit $30 comment $500 subject $6 visit $20 sampdate samptime 4;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; set XXX_raw(firstobs=2);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; study&amp;nbsp;&amp;nbsp; = strip(var1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; barcode = strip(var2);&amp;nbsp;&amp;nbsp; etc, etc.&lt;BR /&gt;Thanks! NJGIRL&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676163#M203839</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2020-08-12T13:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676172#M203842</link>
      <description>&lt;P&gt;You latest example is not using INPUT statement or INPUT() function so it will not have the issue you are talking about.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either the periods are in the variables being set from the exist dataset or they aren't.&amp;nbsp; You haven't shown any code to remove the periods or any code that would create values with period.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 14:06:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676172#M203842</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-12T14:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Infile statement is converting .  (dot) to a blank and I need to preserve the . value.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676321#M203915</link>
      <description>&lt;P&gt;I only displayed the 2nd datastep just for informational purposes so you could see where I was going with the code and to point out that I was establishing the lengths in the 2nd datastep, not the 1st.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All is good. The $char successfully read in the variable in question and properly preserved the '.'&amp;nbsp;(period) . This is a handy format, that, quite frankly, I had forgotten about. This saved a lot of time and I appreciate your quick response.&lt;/P&gt;&lt;P&gt;take care.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 21:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Infile-statement-is-converting-dot-to-a-blank-and-I-need-to/m-p/676321#M203915</guid>
      <dc:creator>NJGIRL</dc:creator>
      <dc:date>2020-08-12T21:22:26Z</dc:date>
    </item>
  </channel>
</rss>

