<?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: Import of csv in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683104#M206859</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you!&lt;BR /&gt;Is it possible to make this changes automatically? I’ll receive this type of file for Input for my program.:(&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to talk to the source for this file and see if they can adjust there process to produce a file that can be parsed.&amp;nbsp; Find out what software they are using to create the file and perhaps there are simple changes in how they create the file that could eliminate this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ask them to remove any carriage return ('0D'x) or linefeed ('0A'x) values from the data fields.&amp;nbsp; They can either just strip them out or replace them with some other character(s).&amp;nbsp; Make sure that fields are separated by the same delimiter. And that any value that contains the delimiter is enclosed in quotes.&amp;nbsp; Any values that contain quotes are also enclosed in quotes and the existing quotes are doubled up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try to recreate the manual step of replacing linefeeds with semi-colons.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename copy temp;
data _null_;
  infile "&amp;amp;path/&amp;amp;fname" termstr=crlf ;
  input;
  _infile_=translate(_infile_,';','0A'x);
  file copy;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But when I do that I notice that some of the lines are close to the limit of 32K bytes that can be handled by the _INFILE_ automatic variable.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;     The minimum record length was 717.
     The maximum record length was 32489.
&lt;/PRE&gt;
&lt;P&gt;So you might need a more complicated process instead that reads the file character by character instead.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Sep 2020 22:15:09 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-09-10T22:15:09Z</dc:date>
    <item>
      <title>Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/682987#M206796</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I can't import the attached file.&lt;/P&gt;
&lt;P&gt;I don't know what is wrong with my code, before it worked well.&lt;/P&gt;
&lt;P&gt;Now the data is completely wrong from the line 756 (if don't edit the file).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I edit the file (even just delete the lines to make the file more light) the data is COMPLITELY wrong.&lt;/P&gt;
&lt;P&gt;The original file is very huge, I can't download it, even with compress, I attached the edited file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data EUROPERF_IMP1;
	dlm=';'||'0D0A'x;
	infile "XXXXXX\Eligibles_c.csv_20200810.csv" dlm=dlm  DSD lrecl=32867 /*termstr=CRLF*/
	RECFM=n;

	informat	CodeIsin	$12.;
	informat	Libelle	$50.;
	informat	nature	$12.;
	informat	categAMF	$32.;
	informat	categEPF	$50.;
	informat	zoneGeo	$40.;
	informat	dureeMinReco $8.;
	informat	affectationResultat	$40.;
	informat	fiscaliteText	$50.;
	informat	deviseComptable	$3.;
	informat	dateCloture	$32.;
	informat	dateOuverture	$32.;
	informat	promoteur	$50.;
	informat	adressePromoteur	$80.;
	informat	steGestion	$70.;
	informat	adresseSteGestion	$80.;
	informat	steAdmDelegue	$80.;
	informat	steFinAdmDelegue	$80.;
	informat	depositaire	$80.;
	informat	adresseDepositaire	$80.;
	informat	commissaireCpte	$50.;
	informat	souscription	$100.;
	informat	rachat	$50.;
	informat	fraisGestion	$70.;
	informat	datePerformance	$12.;
	informat	perf12mois	best32.;
	informat	perf36mois	$5.;
	informat	perf60mois	$5.;
	informat	fraisGestionCommentaire	$256.;
	informat	objectifGestion	$256.;
	informat	souscripteurs	$256.;
	informat	orientationPlacement	$256.;
	informat	dateClotureExercice	$256.;
	informat	periodeVL	$256.;
	informat	sitePublication	$256.;
	informat	conditionSouscripRachat	$256.;
	informat	dateValidation		$12.;
	informat	minimumRisqueAction	$5.;
	informat	dateAgrementAMF		$12.;
	informat	Tfe	$20.;
	informat	perfAm1	$8.;
	informat	perfAm2	$8.;
	informat	perfAm3	$8.;
	informat	perfAm4	$8.;
	informat	perfAm5	$8.;
	informat	perfAm6	$8.;
	informat	perfAm7	$8.;
	informat	perfAm8	$8.;
	informat	UnitedureeMinReco	$7.;
	informat	perfYTD	$5.;
	informat	volat_12mois	$5.;
	informat	frequence_text	$30.;
	informat	prospectus_url	$50.;
	informat	jour_valorisation $8.;
	informat	risque	$6.;
	informat	VIDE	$4.;
	format 	CodeIsin	$12.;
	format 	Libelle	$50.;
	format 	nature	$12.;
	format 	categAMF	$32.;
	format 	categEPF	$50.;
	format 	zoneGeo	$40.;
	format 	dureeMinReco $8.;
	format 	affectationResultat	$40.;
	format 	fiscaliteText	$50.;
	format 	deviseComptable	$3.;
	format 	dateCloture	$32.;
	format 	dateOuverture	$32.;
	format 	promoteur	$50.;
	format 	adressePromoteur	$80.;
	format 	steGestion	$70.;
	format 	adresseSteGestion	$80.;
	format 	steAdmDelegue	$80.;
	format 	steFinAdmDelegue	$80.;
	format 	depositaire	$80.;
	format 	adresseDepositaire	$80.;
	format 	commissaireCpte	$50.;
	format 	souscription	$100.;
	format 	rachat	$5.;
	format 	fraisGestion	$70.;
	format 	datePerformance $12.;
	format 	perf12mois	best32.;
	format 	perf36mois	$5.;
	format 	perf60mois	$5.;
	format 	fraisGestionCommentaire	$256.;
	format 	objectifGestion	$256.;
	format 	souscripteurs	$256.;
	format 	orientationPlacement	$256.;
	format 	dateClotureExercice	$256.;
	format 	periodeVL	$256.;
	format 	sitePublication	$256.;
	format  conditionSouscripRachat	$256.;
	format 	dateValidation		$12.;
	format 	minimumRisqueAction	$5.;
	format 	dateAgrementAMF		$12.;
	format 	Tfe	$20.;
	format 	perfAm1	$8.;
	format 	perfAm2	$8.;
	format 	perfAm3	$8.;
	format 	perfAm4	$8.;
	format 	perfAm5	$8.;
	format 	perfAm6	$8.;
	format 	perfAm7	$8.;
	format 	perfAm8	$8.;
	format 	UnitedureeMinReco	$7.;
	format 	perfYTD	$5.;
	format 	volat_12mois	$5.;
	format 	frequence_text	$30.;
	format 	prospectus_url	$50.;
	format 	jour_valorisation	$8.;
	format 	risque	$6.;
	format	VIDE	$4.;
	input			
		CodeIsin	$ 	
		Libelle	$	
		nature	$	
		categAMF	$	
		categEPF	$	
		zoneGeo	$	
		dureeMinReco $ 		
		affectationResultat	$	
		fiscaliteText	$	
		deviseComptable	$	
		dateCloture	$	
		dateOuverture	$	
		promoteur	$	
		adressePromoteur	$	
		steGestion	$	
		adresseSteGestion	$	
		steAdmDelegue	$	
		steFinAdmDelegue	$	
		depositaire	$	
		adresseDepositaire	$	
		commissaireCpte	$	
		souscription	$	
		rachat	$	
		fraisGestion	$	
		datePerformance	$
		perf12mois		
		perf36mois	$	
		perf60mois $		
		fraisGestionCommentaire	$	
		objectifGestion	$	
		souscripteurs	$
		orientationPlacement	$	
		dateClotureExercice	$	
		periodeVL	$	
		sitePublication	$	
		conditionSouscripRachat	$	
		dateValidation	$	
		minimumRisqueAction	$	
		dateAgrementAMF	$	
		Tfe	$	
		perfAm1	$	
		perfAm2	$	
		perfAm3	$	
		perfAm4	$	
		perfAm5	$	
		perfAm6	$	
		perfAm7	$	
		perfAm8	$	
		UnitedureeMinReco $		
		perfYTD	$	
		volat_12mois $		
		frequence_text	$	
		prospectus_url	$	
		jour_valorisation	$	
		risque 	$	
		VIDE $;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Marie&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 16:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/682987#M206796</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T16:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683055#M206823</link>
      <description>&lt;P&gt;Marie,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My first reaction is that this code doesn't look right to me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dlm=';'||'0D0A'x;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code is saying that each column should be separated by three characters, taken together:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;A semi-colon -- ';'&lt;/LI&gt;
&lt;LI&gt;A carriage return -- '0D'x&lt;/LI&gt;
&lt;LI&gt;A line feed -- '0A'x&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;When I look at the data, I only see the semi-colon between each field.&amp;nbsp; I would change the delimiter setting to only the below and try re-running.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dlm=';'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 19:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683055#M206823</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T19:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683061#M206826</link>
      <description>&lt;P&gt;I changed the program slightly as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data EUROPERF_IMP1;
	infile "R:\users\jbarbou3\Eligibles_c.csv_20200810.csv" 
	MISSOVER
/*	termstr=CRLF*/
	lrecl=32867
	DSD 
	dlm=';'
	RECFM=n
	;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I ran the program, and the data looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Diagonal_Pattern_2020-09-10_12-53-44.jpg" style="width: 849px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49252iDFC2247700CAA785/image-size/large?v=v2&amp;amp;px=999" role="button" title="Diagonal_Pattern_2020-09-10_12-53-44.jpg" alt="Diagonal_Pattern_2020-09-10_12-53-44.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Do you see the diagonal pattern in the data?&amp;nbsp; Whenever I have seen a diagonal pattern like that in the past, that typically means that there is a mis-match between the number of columns defined in the INFILE vs. the number of delimiters (in this case a semi-colon) physically present in the data.&amp;nbsp; I tried adding a MISSOVER parameter, but that did not help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has the data changed or been redefined in any way recently?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 20:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683061#M206826</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T20:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683071#M206830</link>
      <description>&lt;P&gt;Your file has multiple end of line characters inserted into the middle of the lines of data so not all lines have the same number of values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
 infile "&amp;amp;path/&amp;amp;fname" termstr=crlf;
 row+1;
 input;
 words=countw(_infile_,';','mq');
run;

proc freq ; tables words; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;The FREQ Procedure

                                  Cumulative    Cumulative
words    Frequency     Percent     Frequency      Percent
----------------------------------------------------------
   16           1        0.82             1         0.82
   20           1        0.82             2         1.64
   29           1        0.82             3         2.46
   30           1        0.82             4         3.28
   31           5        4.10             9         7.38
   32           1        0.82            10         8.20
   33          22       18.03            32        26.23
   34          25       20.49            57        46.72
   35          11        9.02            68        55.74
   36           3        2.46            71        58.20
   43           1        0.82            72        59.02
   50           2        1.64            74        60.66
   52           1        0.82            75        61.48
   53           2        1.64            77        63.11
   54           4        3.28            81        66.39
   55          11        9.02            92        75.41
   56          30       24.59           122       100.00
&lt;/PRE&gt;
&lt;P&gt;There do not appear to be quotes around them or any other way to safely distinguish the spurios linebreaks from the real end of lines.&lt;/P&gt;
&lt;P&gt;Can you have the file recreated without those characters?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 20:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683071#M206830</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-10T20:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683083#M206840</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;that the best thing would be to have the data re-created with the following in mind:&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The data should &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; include Line Feed ('0A'x) characters within the data.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;The delimiters must consistently be a semi-colon.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;The same number of delimiters must be on each line.&lt;/LI&gt;
&lt;LI&gt;The line terminators should all be a combination of a Carriage Return ('0D'x) and a Line Feed ('0A'x) character (CRLF).&amp;nbsp; The data is already correct as it is, but this must not be changed.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;However, if it would be difficult to re-create the data, the data can be made to work.&amp;nbsp; I made a few changes to the program and the data, and I got the following:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fr_Data_Corrected_2020-09-10_12-53-44.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49253iBD0667CA63D4E998/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fr_Data_Corrected_2020-09-10_12-53-44.jpg" alt="Fr_Data_Corrected_2020-09-10_12-53-44.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Notice that the data is now aligned properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what I did:&lt;/P&gt;
&lt;P&gt;First, the data sometimes contained Line Feed characters&amp;nbsp;('0A'x) as delimiters and sometimes the data contained semi-colons as delimiters.&amp;nbsp; I changed all the &lt;EM&gt;&lt;STRONG&gt;solo&lt;/STRONG&gt;&lt;/EM&gt; Line Feed characters&amp;nbsp;('0A'x) to a semi-colon.&amp;nbsp; Note that however each line is terminated by a &lt;EM&gt;&lt;STRONG&gt;combination&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;Carriage Return ('0D'x) Line Feed ('0A'x).&amp;nbsp; The combination must be preserved.&amp;nbsp; In order to preserve the combinations, I first changed all the combinations ('0D0A'x) to '^^^'.&amp;nbsp; Then I changed all the solo Line Feeds to a semi-colon.&amp;nbsp; Then I changed all the '^^^' back to a combination Carriage Return Line Feed&amp;nbsp;('0D0A'x).&amp;nbsp; It's actually easier that my description may make it sound.&amp;nbsp; I did this in Notepad++ but any good editor should suffice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, I changed the INFILE statement as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	infile "XXXXXXXXXX\Eligibles_c.csv_20200810.csv" 
	termstr=CRLF
	lrecl=32767
	FIRSTOBS=2
	MISSOVER
	RECFM=V
	dlm=';'
	DSD 
	;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The important changes are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The FIRSTOBS must be set to "2" so that the column headers are not treated as data.&lt;/LI&gt;
&lt;LI&gt;The RECFM must be "V" (variable) not "N" (None, which implies streamed data).&lt;/LI&gt;
&lt;LI&gt;The DLM must be ";" and only a semi-colon.&amp;nbsp; CRLF should &lt;EM&gt;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;/EM&gt; be part of the the delimiter.&lt;/LI&gt;
&lt;LI&gt;The TERMSTR must be CRLF.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I did change the LRECL slightly, but this is not too important as long as the LRECL is longer than the longest record.&amp;nbsp; If you start getting truncation, you should increase this parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, in conclusion, I fully agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;that the best thing would be to go back to whoever created the data in the first place and have them re-create the data correctly.&amp;nbsp; However, if you cannot reasonably have the data re-created, then you can change the solo Line Feed characters to semi-colons, make the program changes I described above, and the program will work correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this is helpful,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683083#M206840</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T21:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683084#M206841</link>
      <description>Thank you,&lt;BR /&gt;I tried this, but it doesn’t work:(</description>
      <pubDate>Thu, 10 Sep 2020 21:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683084#M206841</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T21:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683087#M206844</link>
      <description>&lt;P&gt;Yes, I now understand more, and you are correct. Please see my latest response, the very last one, below.&lt;BR /&gt;&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683087#M206844</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T21:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683088#M206845</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;If I edit the file (even just delete the lines to make the file more light) the data is COMPLITELY wrong.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Never open a CSV file with Excel.&amp;nbsp; It can totally corrupt the data.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683088#M206845</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-10T21:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683089#M206846</link>
      <description>You mean that It would be better to openly the csv with Notepad? &lt;BR /&gt;Thank you!</description>
      <pubDate>Thu, 10 Sep 2020 21:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683089#M206846</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T21:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683090#M206847</link>
      <description>Thank you very much!&lt;BR /&gt;You changed the line feeds on Notepad please?</description>
      <pubDate>Thu, 10 Sep 2020 21:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683090#M206847</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T21:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683091#M206848</link>
      <description>I can’t ask to recreate the file:( Could we do this changes automatically please with SAS? &lt;BR /&gt;Thank you!</description>
      <pubDate>Thu, 10 Sep 2020 21:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683091#M206848</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T21:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683092#M206849</link>
      <description>&lt;P&gt;Never (as in&amp;nbsp;&lt;STRONG&gt;NEVER&lt;/STRONG&gt;) &lt;EM&gt;inspect&lt;/EM&gt; a CSV file with Excel. Use a programmer's editor like Notepad++ for this. Such editors keep the textual structure and will only do the changes&amp;nbsp;&lt;EM&gt;you&lt;/EM&gt; make.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683092#M206849</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-10T21:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683093#M206850</link>
      <description>&lt;P&gt;I used Notepad++ not regular Notepad.&amp;nbsp; There are probably other editors that would work as well, but I believe that Notepad++ is free.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683093#M206850</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T21:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683095#M206851</link>
      <description>Thank you! &lt;BR /&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683095#M206851</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T21:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683096#M206852</link>
      <description>&lt;P&gt;You might need more than just regular Notepad.&amp;nbsp; Regular Notepad will not show the Carriage Return and Line Feed characters.&amp;nbsp; I used Notepad++.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 21:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683096#M206852</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T21:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683097#M206853</link>
      <description>Thank you!&lt;BR /&gt;Is it possible to make this changes automatically? I’ll receive this type of file for Input for my program.:(</description>
      <pubDate>Thu, 10 Sep 2020 21:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683097#M206853</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T21:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683099#M206854</link>
      <description>Thank you!</description>
      <pubDate>Thu, 10 Sep 2020 22:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683099#M206854</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T22:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683101#M206856</link>
      <description>Sorry Tom,&lt;BR /&gt;I’m curios)) Why Excel corrupts the csv? The encoding is not same?</description>
      <pubDate>Thu, 10 Sep 2020 22:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683101#M206856</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-09-10T22:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683102#M206857</link>
      <description>&lt;P&gt;Yes, these changes can be done with SAS.&amp;nbsp; We would need two data steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first Data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA	NULL;
	infile "XXX\Eligibles_c.csv_20200810_Original.csv"
	termstr=CRLF
	lrecl=32767
	RECFM=V
	;

	INPUT;
	_INFILE_	=	TRANWRD(_INFILE_, '0D0A'x, '^^^^');
	_INFILE_	=	TRANWRD(_INFILE_, '0A'x, ';');
	_INFILE_	=	TRANWRD(_INFILE_, '^^^^', '0D0A'x);
	file "XXX\Eligibles_c.csv_20200810_SAS_Edit.csv";
	PUT	_INFILE_;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first data step uses the original file, the file with the problems in the data.&amp;nbsp; The first Data step corrects the problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second data step then uses the file created by the first data step, above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data EUROPERF_IMP1_SAS;
	infile "XXX\Eligibles_c.csv_20200810_SAS_Edit.csv"
	termstr=CRLF
	lrecl=32767
	FIRSTOBS=2
	MISSOVER
	RECFM=V
	dlm=';'
	DSD 
	;

	/*	56 Columns	*/
	informat	CodeIsin	$12.;
	informat	Libelle	$50.;
	informat	nature	$12.;
	informat	categAMF	$32.;
	informat	categEPF	$50.;
	informat	zoneGeo	$40.;
	informat	dureeMinReco $8.;
	informat	affectationResultat	$40.;
	informat	fiscaliteText	$50.;
	informat	deviseComptable	$3.;
	informat	dateCloture	$32.;
	informat	dateOuverture	$32.;
	informat	promoteur	$50.;
	informat	adressePromoteur	$80.;
	informat	steGestion	$70.;
	informat	adresseSteGestion	$80.;
	informat	steAdmDelegue	$80.;
	informat	steFinAdmDelegue	$80.;
	informat	depositaire	$80.;
	informat	adresseDepositaire	$80.;
	informat	commissaireCpte	$50.;
	informat	souscription	$100.;
	informat	rachat	$50.;
	informat	fraisGestion	$70.;
	informat	datePerformance	$12.;
	informat	perf12mois	best32.;
	informat	perf36mois	$5.;
	informat	perf60mois	$5.;
	informat	fraisGestionCommentaire	$256.;
	informat	objectifGestion	$256.;
	informat	souscripteurs	$256.;
	informat	orientationPlacement	$256.;
	informat	dateClotureExercice	$256.;
	informat	periodeVL	$256.;
	informat	sitePublication	$256.;
	informat	conditionSouscripRachat	$256.;
	informat	dateValidation		$12.;
	informat	minimumRisqueAction	$5.;
	informat	dateAgrementAMF		$12.;
	informat	Tfe	$20.;
	informat	perfAm1	$8.;
	informat	perfAm2	$8.;
	informat	perfAm3	$8.;
	informat	perfAm4	$8.;
	informat	perfAm5	$8.;
	informat	perfAm6	$8.;
	informat	perfAm7	$8.;
	informat	perfAm8	$8.;
	informat	UnitedureeMinReco	$7.;
	informat	perfYTD	$5.;
	informat	volat_12mois	$5.;
	informat	frequence_text	$30.;
	informat	prospectus_url	$50.;
	informat	jour_valorisation $8.;
	informat	risque	$6.;
	informat	VIDE	$4.;

	/*	56 Columns	*/
	format 	CodeIsin	$12.;
	format 	Libelle	$50.;
	format 	nature	$12.;
	format 	categAMF	$32.;
	format 	categEPF	$50.;
	format 	zoneGeo	$40.;
	format 	dureeMinReco $8.;
	format 	affectationResultat	$40.;
	format 	fiscaliteText	$50.;
	format 	deviseComptable	$3.;
	format 	dateCloture	$32.;
	format 	dateOuverture	$32.;
	format 	promoteur	$50.;
	format 	adressePromoteur	$80.;
	format 	steGestion	$70.;
	format 	adresseSteGestion	$80.;
	format 	steAdmDelegue	$80.;
	format 	steFinAdmDelegue	$80.;
	format 	depositaire	$80.;
	format 	adresseDepositaire	$80.;
	format 	commissaireCpte	$50.;
	format 	souscription	$100.;
	format 	rachat	$5.;
	format 	fraisGestion	$70.;
	format 	datePerformance $12.;
	format 	perf12mois	best32.;
	format 	perf36mois	$5.;
	format 	perf60mois	$5.;
	format 	fraisGestionCommentaire	$256.;
	format 	objectifGestion	$256.;
	format 	souscripteurs	$256.;
	format 	orientationPlacement	$256.;
	format 	dateClotureExercice	$256.;
	format 	periodeVL	$256.;
	format 	sitePublication	$256.;
	format  conditionSouscripRachat	$256.;
	format 	dateValidation		$12.;
	format 	minimumRisqueAction	$5.;
	format 	dateAgrementAMF		$12.;
	format 	Tfe	$20.;
	format 	perfAm1	$8.;
	format 	perfAm2	$8.;
	format 	perfAm3	$8.;
	format 	perfAm4	$8.;
	format 	perfAm5	$8.;
	format 	perfAm6	$8.;
	format 	perfAm7	$8.;
	format 	perfAm8	$8.;
	format 	UnitedureeMinReco	$7.;
	format 	perfYTD	$5.;
	format 	volat_12mois	$5.;
	format 	frequence_text	$30.;
	format 	prospectus_url	$50.;
	format 	jour_valorisation	$8.;
	format 	risque	$6.;
	format	VIDE	$4.;

	/*	56 Columns	*/
	input			
		CodeIsin	$ 	
		Libelle	$	
		nature	$	
		categAMF	$	
		categEPF	$	
		zoneGeo	$	
		dureeMinReco $ 		
		affectationResultat	$	
		fiscaliteText	$	
		deviseComptable	$	
		dateCloture	$	
		dateOuverture	$	
		promoteur	$	
		adressePromoteur	$	
		steGestion	$	
		adresseSteGestion	$	
		steAdmDelegue	$	
		steFinAdmDelegue	$	
		depositaire	$	
		adresseDepositaire	$	
		commissaireCpte	$	
		souscription	$	
		rachat	$	
		fraisGestion	$	
		datePerformance	$
		perf12mois		
		perf36mois	$	
		perf60mois $		
		fraisGestionCommentaire	$	
		objectifGestion	$	
		souscripteurs	$
		orientationPlacement	$	
		dateClotureExercice	$	
		periodeVL	$	
		sitePublication	$	
		conditionSouscripRachat	$	
		dateValidation	$	
		minimumRisqueAction	$	
		dateAgrementAMF	$	
		Tfe	$	
		perfAm1	$	
		perfAm2	$	
		perfAm3	$	
		perfAm4	$	
		perfAm5	$	
		perfAm6	$	
		perfAm7	$	
		perfAm8	$	
		UnitedureeMinReco $		
		perfYTD	$	
		volat_12mois $		
		frequence_text	$	
		prospectus_url	$	
		jour_valorisation	$	
		risque 	$	
		VIDE $;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why don't you try this code and let me know if it works?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 23:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683102#M206857</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-10T23:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Import of csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683104#M206859</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you!&lt;BR /&gt;Is it possible to make this changes automatically? I’ll receive this type of file for Input for my program.:(&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to talk to the source for this file and see if they can adjust there process to produce a file that can be parsed.&amp;nbsp; Find out what software they are using to create the file and perhaps there are simple changes in how they create the file that could eliminate this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ask them to remove any carriage return ('0D'x) or linefeed ('0A'x) values from the data fields.&amp;nbsp; They can either just strip them out or replace them with some other character(s).&amp;nbsp; Make sure that fields are separated by the same delimiter. And that any value that contains the delimiter is enclosed in quotes.&amp;nbsp; Any values that contain quotes are also enclosed in quotes and the existing quotes are doubled up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try to recreate the manual step of replacing linefeeds with semi-colons.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename copy temp;
data _null_;
  infile "&amp;amp;path/&amp;amp;fname" termstr=crlf ;
  input;
  _infile_=translate(_infile_,';','0A'x);
  file copy;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But when I do that I notice that some of the lines are close to the limit of 32K bytes that can be handled by the _INFILE_ automatic variable.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;     The minimum record length was 717.
     The maximum record length was 32489.
&lt;/PRE&gt;
&lt;P&gt;So you might need a more complicated process instead that reads the file character by character instead.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 22:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-of-csv/m-p/683104#M206859</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-09-10T22:15:09Z</dc:date>
    </item>
  </channel>
</rss>

