I got the same question when importing a large csv file (more than 2000 columns with long field names). SAS CAN NOT READ THE COLUMN'S NAME.
I refered to "thread376-1407206": and tried klaz2002's method.
"*** YOUR TEMP FILE ***;
filename tmp 'c:\temp\_a.dat';
*** YOUR CSV FILE (THIS WILL CHANGE FOR EACH NEW CSV FILE) ***;
filename in 'c:\temp\a.csv';
data _null_;
infile in;
file tmp;
length intext $2000;
retain i 0;
input intext &;
if index(intext, '!') gt 0 then
i = 1;
*** ONLY OUTPUT THE DATA AFTER THE ! CHAR IS FOUND ***;
if i=1 then do;
put intext;
end;
run;
*** NOW USE PROC IMPORT IN THE NORMAL WAY ***;
proc import
datafile = "%SYSFUNC(PATHNAME(tmp))"
OUT = cup
dbms = csv replace;
getnames = yes;
datarow = 2;
run; "
however, 0 records were written to the file TMP. Could anybody can help?
Thank you very much.
I refered to "thread376-1407206": and tried klaz2002's method.
"*** YOUR TEMP FILE ***;
filename tmp 'c:\temp\_a.dat';
*** YOUR CSV FILE (THIS WILL CHANGE FOR EACH NEW CSV FILE) ***;
filename in 'c:\temp\a.csv';
data _null_;
infile in;
file tmp;
length intext $2000;
retain i 0;
input intext &;
if index(intext, '!') gt 0 then
i = 1;
*** ONLY OUTPUT THE DATA AFTER THE ! CHAR IS FOUND ***;
if i=1 then do;
put intext;
end;
run;
*** NOW USE PROC IMPORT IN THE NORMAL WAY ***;
proc import
datafile = "%SYSFUNC(PATHNAME(tmp))"
OUT = cup
dbms = csv replace;
getnames = yes;
datarow = 2;
run; "
however, 0 records were written to the file TMP. Could anybody can help?
Thank you very much.