<?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: proc import in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795519#M255182</link>
    <description>&lt;P&gt;Look at the LOG. There should be data step code generated that will show the informat used to read the values.&lt;/P&gt;
&lt;P&gt;It may help to copy from the log that data step and paste it into a text box opened on the forum using the &amp;lt;/&amp;gt; icon so we can see details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am going to &lt;STRONG&gt;guess&lt;/STRONG&gt;, since you don't provide what is meant by "wrong" , that the commas are supposed to separate the integer portion of a number from the decimal portion. Is that what is supposed to happen?&lt;/P&gt;
&lt;P&gt;This is possibly a result of the NLS (National Language Settings) in effect as well.&lt;/P&gt;
&lt;P&gt;You might want to run this code and then show us what the result is that appears in the log.&lt;/P&gt;
&lt;PRE&gt;Proc options option=locale;
run;
&lt;/PRE&gt;
&lt;P&gt;For example on my system it shows:&lt;/P&gt;
&lt;PRE&gt;LOCALE=EN_US      Specifies a set of attributes in a SAS session that reflect the language,
                   local conventions, and culture for a geographical region.
&lt;/PRE&gt;
&lt;P&gt;The rules used for "local conventions" can affect how commas are read and treated.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Feb 2022 16:23:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-02-10T16:23:42Z</dc:date>
    <item>
      <title>proc import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795505#M255174</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file="\xxxx\test.txt"
    out=work.ISRdata
    dbms=tab
	replace;GETNAMES=NO
   ;guessingrows =10000; 
    delimiter='09'x;
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It doesn't get the commas right, it moves them one to the left.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Var7 is&amp;nbsp;201,836 ?&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;</description>
      <pubDate>Thu, 10 Feb 2022 15:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795505#M255174</guid>
      <dc:creator>Kiteulf</dc:creator>
      <dc:date>2022-02-10T15:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: proc import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795519#M255182</link>
      <description>&lt;P&gt;Look at the LOG. There should be data step code generated that will show the informat used to read the values.&lt;/P&gt;
&lt;P&gt;It may help to copy from the log that data step and paste it into a text box opened on the forum using the &amp;lt;/&amp;gt; icon so we can see details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am going to &lt;STRONG&gt;guess&lt;/STRONG&gt;, since you don't provide what is meant by "wrong" , that the commas are supposed to separate the integer portion of a number from the decimal portion. Is that what is supposed to happen?&lt;/P&gt;
&lt;P&gt;This is possibly a result of the NLS (National Language Settings) in effect as well.&lt;/P&gt;
&lt;P&gt;You might want to run this code and then show us what the result is that appears in the log.&lt;/P&gt;
&lt;PRE&gt;Proc options option=locale;
run;
&lt;/PRE&gt;
&lt;P&gt;For example on my system it shows:&lt;/P&gt;
&lt;PRE&gt;LOCALE=EN_US      Specifies a set of attributes in a SAS session that reflect the language,
                   local conventions, and culture for a geographical region.
&lt;/PRE&gt;
&lt;P&gt;The rules used for "local conventions" can affect how commas are read and treated.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 16:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795519#M255182</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-10T16:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795527#M255187</link>
      <description>&lt;P&gt;Why are you using PROC IMPORT to read a file that does not have column headers and which has only 19 variables?&lt;/P&gt;
&lt;P&gt;Just write your own data step to read it.&lt;/P&gt;
&lt;P&gt;Then you can set the NAMES, TYPES, LENGTHS for the variables and tell SAS which INFORMAT to use when reading those numbers that are using commas where periods are expected.&lt;/P&gt;
&lt;P&gt;Looks like the first 5 variables are identifiers so read them as character strings.&lt;/P&gt;
&lt;P&gt;If you want to force SAS to treat commas as meaning a decimal point use the COMMAX informat.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1561  data test;
1562    infile 'c:\downloads\test.txt' dlm='09'x dsd truncover firstobs=1 ;
1563    length VAR1 $3 VAR2 $6 VAR3 $6 VAR4 $2 VAR5 $6 VAR6-VAR19 8;
1564    informat VAR6-VAR19 commax.;
1565    input VAR1 -- VAR19 ;
1566    if _n_=1 then list;
1567  run;

NOTE: A byte-order mark in the file "c:\downloads\test.txt" (for fileref "#LN00140") indicates that the data is encoded in "utf-8".
      This encoding will be used to process the file.
NOTE: The infile 'c:\downloads\test.txt' is:
      Filename=c:\downloads\test.txt,
      RECFM=V,LRECL=131068,File Size (bytes)=116,
      Last Modified=10 février 2022 11 h 29,
      Create Time=10 février 2022 11 h 29

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0

1   CHAR  NOR.202001.689432.CC.K01_VG.1.2018,36.2018,36.2018,36.1257,93.0,00.0,00.1717,29.664,09.0,00.0,00.0,0
    ZONE  4450333333033333304404335540303333233033332330333323303333233032330323303333233033323303233032330323
    NUMR  EF2920200196894329339B01F679192018C3692018C3692018C3691257C9390C0090C0091717C299664C0990C0090C0090C0

     101  0.0,00.0,00 111
    ZONE  30323303233
    NUMR  090C0090C00
NOTE: 1 record was read from the infile 'c:\downloads\test.txt'.
      The minimum record length was 111.
      The maximum record length was 111.
NOTE: The data set WORK.TEST has 1 observations and 19 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


1568
1569  data _null_;
1570    set test (obs=1);
1571    put (_all_) (=/);
1572  run;


VAR1=NOR
VAR2=202001
VAR3=689432
VAR4=CC
VAR5=K01_VG
VAR6=1
VAR7=2018.36
VAR8=2018.36
VAR9=2018.36
VAR10=1257.93
VAR11=0
VAR12=0
VAR13=1717.29
VAR14=664.09
VAR15=0
VAR16=0
VAR17=0
VAR18=0
VAR19=0
NOTE: There were 1 observations read from the data set WORK.TEST.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 16:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import/m-p/795527#M255187</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-10T16:47:06Z</dc:date>
    </item>
  </channel>
</rss>

