<?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: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622798#M77302</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the response. However, while uploading the sample data, I've ensured that each variable name is 32 characters or less and that there are no duplicate records. So the truncation will not occur in the datastep or proc import.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even I thought this would have been the issue, but unfortunately it has more to do with the LRECL than with the variable length in my case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the code snippet and response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neel&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2020 17:39:04 GMT</pubDate>
    <dc:creator>neeld1</dc:creator>
    <dc:date>2020-02-06T17:39:04Z</dc:date>
    <item>
      <title>Length of first row in csv greater than 32767 - Proc Import not reading in variable names correctly</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622771#M77297</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a noob sas user. I'm more proficient in R, but SAS is totally new to me. I'm facing multiple issues reading a large file too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import
	datafile = ".\my_data.csv"
	out = work.imported_data
	dbms = csv
	replace;
	guessingrows = 1000;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The csv file that I'm trying to import does not read in the correct variable names. My csv has 3055 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, proc export is reading the variables names up to 2933 variables correctly and then renaming the remaining variables as VAR2934, VAR2935, VAR2936... VAR3055.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried getnames = no and obs = 1 option as well. The first row does not read in correctly. I've found the issue on google. It seems that the LRECL of the first row is greater than 32767 bytes/characters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how I can change the LRECL to read in the data correctly?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the data and code for your reference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I have to manually rename the variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest. Your help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Neel&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622771#M77297</guid>
      <dc:creator>neeld1</dc:creator>
      <dc:date>2020-02-06T16:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can a SPSS SAV file be compressed in PROC EXPORT?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622767#M77308</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;- Thank you so much for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a noob sas user. I'm more proficient in R, but SAS is totally new to me. I'm facing multiple issues reading a large file too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can create a new thread or post down below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The csv file that I'm trying to import does not read in the correct variable names. My csv has 3055 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, proc export is reading the variables names up to 2933 variables correctly and then renaming the remaining variables as VAR2934, VAR2935, VAR2936... VAR3055.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried getnames = no and obs = 1 option as well. The first row does not read in correctly. I've found the issue on google. It seems that the LRECL of the first row is greater than 32767 bytes/characters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how I can change the LRECL to read in the data correctly?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import
	datafile = ".\&amp;amp;wave6dsn..csv"
	out = all&amp;amp;w6suffix.
	dbms = csv
	replace;
	guessingrows = 1000;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Neel&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:25:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622767#M77308</guid>
      <dc:creator>neeld1</dc:creator>
      <dc:date>2020-02-06T16:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622775#M77298</link>
      <description>&lt;P&gt;I think this has been answered before.&amp;nbsp; The solution is to create a fileref so you can tell SAS what record length to use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename csv  ".\my_data.csv" lrecl=2000000 ;

proc import
	datafile = csv
	dbms = csv
	out = work.imported_data
	replace
;
	guessingrows = 1000;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 16:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622775#M77298</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-06T16:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622782#M77299</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the response. Unfortunately, I've tried this solution before and it does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could download the data and syntax and try it as well. It does not seem to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies, but I am a very new user to SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35890iFE9782CAA41946EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35891iCE151CD7A9C8AD15/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Neel&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 17:07:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622782#M77299</guid>
      <dc:creator>neeld1</dc:creator>
      <dc:date>2020-02-06T17:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622785#M77300</link>
      <description>&lt;P&gt;If the text of two or more column headings is exactly the same for the first 32 characters then SAS will name the&amp;nbsp;first column with the first 32 characters and remaining&amp;nbsp;variable(s) with VAR and the column number because it doesn't have any fancy instructions on trying to parse the column headers multiple times to try to resolve the like issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An example: replace the path placeholder with a path that works on your system:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   file "&amp;lt;path&amp;gt;\longcolumnname.csv" ;
   put 'columnheadinglongerthan32charactersnumber1,columnheadinglongerthan32charactersnumber2';
   put '123,456';
run;

proc import datafile= "&amp;lt;path&amp;gt;\longcolumnname.csv"
     out=work.import
     dbms=csv
     replace;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Feb 2020 17:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622785#M77300</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-02-06T17:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622790#M77301</link>
      <description>&lt;P&gt;If you have SAS Enterprise Guide, you can use the Import Data task to bootstrap and generate DATA step and INFILE, which gives you more control over how a file is read.&amp;nbsp; I've attached the generated code for your sample file.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 17:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622790#M77301</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2020-02-06T17:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622798#M77302</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the response. However, while uploading the sample data, I've ensured that each variable name is 32 characters or less and that there are no duplicate records. So the truncation will not occur in the datastep or proc import.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even I thought this would have been the issue, but unfortunately it has more to do with the LRECL than with the variable length in my case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the code snippet and response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neel&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 17:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622798#M77302</guid>
      <dc:creator>neeld1</dc:creator>
      <dc:date>2020-02-06T17:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622807#M77303</link>
      <description>&lt;P&gt;Just tell PROC IMPORT to ignore the header row.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename csv "&amp;amp;path/my_data.csv" lrecl=2000000;
proc import datafile=csv out=test1 replace dbms=csv;
 getnames=no;
 datarow=2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use it to rename the variables yourself.&amp;nbsp; So get the names that PROC IMPORT generated.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=test1(obs=0) out=names ;
 var _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then read in the name from the first row and use them to generate RENAME statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_names;
  infile csv obs=1 dsd ;
  input new_name :$32. @@;
run;

filename code temp;
data _null_;
  file code;
  set names end=eof;
  if not eof2 then set new_names end=eof2;
  if _n_=1 then put 'rename';
  put _name_ '=' new_name  ;
  if eof then put ';';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use PROC DATASETS to run the rename.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets nolist lib=work;
  modify test1;
  %include code;
run;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 20:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622807#M77303</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-06T20:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can a SPSS SAV file be compressed in PROC EXPORT?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622857#M77309</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310287"&gt;@neeld1&lt;/a&gt;&amp;nbsp;- Please post the SAS log of your program.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 20:05:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622857#M77309</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-02-06T20:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622870#M77314</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the solution. This solution does work!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would have liked a more succinct solution that would not require me to open sas enterprise, how this does do the trick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Neel&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 21:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622870#M77314</guid>
      <dc:creator>neeld1</dc:creator>
      <dc:date>2020-02-06T21:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Length of first row in csv greater than 32767 - Proc Import not reading in variable names correc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622876#M77315</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;- Bravo!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I need. Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neel&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 21:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Length-of-first-row-in-csv-greater-than-32767-Proc-Import-not/m-p/622876#M77315</guid>
      <dc:creator>neeld1</dc:creator>
      <dc:date>2020-02-06T21:21:00Z</dc:date>
    </item>
  </channel>
</rss>

