Hello, I've been given a few CSV type files I need to read into SAS, normally I'd use Proc Import and have no problems however there's some extra lines in these CSV type files which seem to baffle proc import.
Here's an example:-
blah blah blah blah blah
blah_blah, blah
blah, blah
blah,T1,I,I,I,I
!,SPCODE,POLREF,INRREF,COVREF,AGE_AT_ENTRY
*,1,91000074,1,1,26
*,2,91000077,1,1,26
I've substituted some descriptions with blah as it might be confidential. If I use:-
proc import datafile="C:\SP\test.rpt"
OUT=cup
dbms=csv replace;
getnames=yes;
datarow=5;
run;
proc print data=cup;
run;
I end up with VAR1 to VAR6 as my variable names instead of ! SPCODE POLREF INRREF COVREF AGE_AT_ENTRY. No matter where I place my datarow I end up with VAR1 to VAR6. Manually inputting variables with infile isn't an option as there's about 260 vars, also they have different layouts between csv files.
Is there a way round this or are my CSV files junk and SAS cannot read them in.
Thanks
SP
SAS v8.2
Here's an example:-
blah blah blah blah blah
blah_blah, blah
blah, blah
blah,T1,I,I,I,I
!,SPCODE,POLREF,INRREF,COVREF,AGE_AT_ENTRY
*,1,91000074,1,1,26
*,2,91000077,1,1,26
I've substituted some descriptions with blah as it might be confidential. If I use:-
proc import datafile="C:\SP\test.rpt"
OUT=cup
dbms=csv replace;
getnames=yes;
datarow=5;
run;
proc print data=cup;
run;
I end up with VAR1 to VAR6 as my variable names instead of ! SPCODE POLREF INRREF COVREF AGE_AT_ENTRY. No matter where I place my datarow I end up with VAR1 to VAR6. Manually inputting variables with infile isn't an option as there's about 260 vars, also they have different layouts between csv files.
Is there a way round this or are my CSV files junk and SAS cannot read them in.
Thanks
SP
SAS v8.2