<?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: LRECL in infile statment informat don't work in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464982#M30086</link>
    <description>&lt;P&gt;First of all, your data step is missing several semicolons:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.&amp;amp;table_name;
INFILE "/data/XXX/Lignes/&amp;amp;fichier"
LRECL=603
ENCODING="LATIN9"
TERMSTR=CRLF
DLM=';' FIRSTOBS=2
MISSOVER
DSD ;
INPUT
'VARIABLE A'n : $27.
vARIABLE B: $34.
;
FORMAT
'VARIABLE A'n $27.
vARIABLE B $34.
;
INFORMAT
'VARIABLE A'n $27.
vARIABLE B $34.
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;second, I STRONGLY advise you to not use the named literal construct:&lt;/P&gt;
&lt;PRE&gt;'VARIABLE A'n&lt;/PRE&gt;
&lt;P&gt;Use a proper SAS name instead:&lt;/P&gt;
&lt;PRE&gt;variable_a&lt;/PRE&gt;
&lt;P&gt;and put nicely formatted text into the label, where it belongs.&lt;/P&gt;
&lt;P&gt;Third, I have a strong suspicion that this input statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INPUT
'VARIABLE A'n : $27.
vARIABLE B: $34.
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will not do what you want, as it creates a character variable 'VARIABLE A' of length 27, a numeric variable vARIABLE, and a character variable B of length 34.&lt;/P&gt;
&lt;P&gt;Here you already have one of the pitfalls caused by using named literals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regarding your question:&lt;/P&gt;
&lt;P&gt;The space required by a SAS dataset is determined (roughly) by observation size * observation number, where observation size is the sum of all lengths of all variables in an observation. So if you read only three numbers from a file with lrecl=32767, the observation size will still be just 24.&lt;/P&gt;
&lt;P&gt;lrecl= just determines the size of the buffer set aside for reading a single line from the input file; what goes into the dataset is determined solely by the following data step statements.&lt;/P&gt;</description>
    <pubDate>Fri, 25 May 2018 08:11:26 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-05-25T08:11:26Z</dc:date>
    <item>
      <title>LRECL in infile statment informat don't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464969#M30077</link>
      <description>&lt;DIV&gt;Hi!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm want to import a lot of CSV(DLM=';') files and&amp;nbsp; because I had problems with numeric and data variables, I did a Data step and&amp;nbsp; INFILE to can change the informat and the format.&lt;/DIV&gt;&lt;DIV&gt;To know which informat choose in every variable, I did before an import with the sas's assistant for one file and I copied the program from the log and I modified thant a little.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The problem is: in this code there is a parameter 'LRECL' with a determinate value choosed by Sas but if I set the same value (or the default value) for all files the informat and format choosed do not work in the others files, and is very difficult to know which value set for every file because I have a lot of files.&lt;/DIV&gt;&lt;DIV&gt;Do you know another way to make that?&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't understand why the format and informat works in this situation and do not work in another.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I copy here the structure of my program.&lt;/DIV&gt;&lt;DIV&gt;If you know a way to choose always the right informat I will be very grateful, I have often problem with that.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks you very much!&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 May 2018 07:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464969#M30077</guid>
      <dc:creator>luciacossaro</dc:creator>
      <dc:date>2018-05-25T07:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: LRECL in infile statment informat don't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464974#M30080</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165493"&gt;@luciacossaro&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I believe you forgot to post your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general:&lt;/P&gt;
&lt;P&gt;LRECL tells SAS how long a source record can be - but the source record doesn't have to be that long. If you want to be on the safe side then just use a value for LRECL which is for sure always a bit bigger than the longest source record you can reasonably expect.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 07:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464974#M30080</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-05-25T07:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: LRECL in infile statment informat don't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464978#M30082</link>
      <description>&lt;P&gt;Thank you very much for your reponse. I paste below the code structure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i understood correctly, I must look for the LRECL's value which work ok&amp;nbsp;for the biggest file and then set this value&amp;nbsp;in&amp;nbsp;the LRECL&amp;nbsp;for all the files ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This does not generate the problems of disk space? I have to import several big files.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO import (fichier=,table_name=);
DATA WORK.&amp;amp;table_name;
INFILE "/data/XXX/Lignes/&amp;amp;fichier"
LRECL=603
ENCODING="LATIN9"
TERMSTR=CRLF
DLM=';' FIRSTOBS=2
MISSOVER
DSD ;
INPUT
'VARIABLE A'n : $27.
vARIABLE B: $34.

FORMAT
'VARIABLE A'n $27.
vARIABLE B $34.

INFORMAT
'VARIABLE A'n $27.
vARIABLE B $34.

RUN;

%MEND;

%import (fichier=file_AB.csv, table_name=table_sas_AB);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 May 2018 08:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464978#M30082</guid>
      <dc:creator>luciacossaro</dc:creator>
      <dc:date>2018-05-25T08:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: LRECL in infile statment informat don't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464982#M30086</link>
      <description>&lt;P&gt;First of all, your data step is missing several semicolons:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.&amp;amp;table_name;
INFILE "/data/XXX/Lignes/&amp;amp;fichier"
LRECL=603
ENCODING="LATIN9"
TERMSTR=CRLF
DLM=';' FIRSTOBS=2
MISSOVER
DSD ;
INPUT
'VARIABLE A'n : $27.
vARIABLE B: $34.
;
FORMAT
'VARIABLE A'n $27.
vARIABLE B $34.
;
INFORMAT
'VARIABLE A'n $27.
vARIABLE B $34.
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;second, I STRONGLY advise you to not use the named literal construct:&lt;/P&gt;
&lt;PRE&gt;'VARIABLE A'n&lt;/PRE&gt;
&lt;P&gt;Use a proper SAS name instead:&lt;/P&gt;
&lt;PRE&gt;variable_a&lt;/PRE&gt;
&lt;P&gt;and put nicely formatted text into the label, where it belongs.&lt;/P&gt;
&lt;P&gt;Third, I have a strong suspicion that this input statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INPUT
'VARIABLE A'n : $27.
vARIABLE B: $34.
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will not do what you want, as it creates a character variable 'VARIABLE A' of length 27, a numeric variable vARIABLE, and a character variable B of length 34.&lt;/P&gt;
&lt;P&gt;Here you already have one of the pitfalls caused by using named literals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regarding your question:&lt;/P&gt;
&lt;P&gt;The space required by a SAS dataset is determined (roughly) by observation size * observation number, where observation size is the sum of all lengths of all variables in an observation. So if you read only three numbers from a file with lrecl=32767, the observation size will still be just 24.&lt;/P&gt;
&lt;P&gt;lrecl= just determines the size of the buffer set aside for reading a single line from the input file; what goes into the dataset is determined solely by the following data step statements.&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 08:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464982#M30086</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-25T08:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: LRECL in infile statment informat don't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464983#M30087</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165493"&gt;@luciacossaro&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;LRECL is used to read data from source into the SAS buffer (1 line at a time). It has nothing to do with how much disk space gets used when writing the SAS file to disk.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having an unnecessarily overlong LRECL will cause SAS to assign more memory to the buffer and impact a bit on performance and memory usage - but this is it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're concerned about disk storage then make sure to use option COMPRESS.&lt;/P&gt;
&lt;PRE&gt;%MACRO import (fichier=,table_name=);
  DATA WORK.&amp;amp;table_name (compress=yes);
 ........
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 08:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464983#M30087</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-05-25T08:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: LRECL in infile statment informat don't work</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464984#M30088</link>
      <description>&lt;P&gt;Just to clarify, this is how I would write the data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.&amp;amp;table_name;
infile
  "/data/XXX/Lignes/&amp;amp;fichier"
  lrecl=603
  encoding="LATIN9"
  termstr=CRLF
  dlm=';'
  firstobs=2
  truncover
  dsd
;
input
  variable_a :$27.
  variable_b :$34.
;
label
  variable_a = "VARIABLE A"
  variable_b = "VARIABLE B"
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;informat and format as posted by you are redundant for character variables, so I omitted them.&lt;/P&gt;
&lt;P&gt;Note how indendation makes functional blocks visible.&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 08:16:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/LRECL-in-infile-statment-informat-don-t-work/m-p/464984#M30088</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-25T08:16:38Z</dc:date>
    </item>
  </channel>
</rss>

