Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

proc importing csv file

Status
Not open for further replies.

shellylee

Technical User
Feb 10, 2011
1
CA
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top