looking for some solutions? You are welcome.

SOLVED: increase the column name limit when importing dbfs from a folder

RAB:

I am using SAS 9.4

I have written a macro to read all .dbf files from a given library (a derived library I have specified), but it consistently truncates my column names to about 10 characters.

Is there an easy way to increase the column name character limit?

Ideally I would like the column names to be up to 30 characters long.

Hopefully there is enough info here, let me know if you need any more from me on this one. Pretty new to SAS.

macro:

%macro readindbf; 

   filename DIRLIST pipe "dir &rawdata.\*.dbf /b ";
   data dirlist;
     infile dirlist lrecl=200 truncover;
     input file_name $100.;
     run;
   data _null_;
     set dirlist end=end;
     count+1;
     call symputx('readdbf'||put(count, 4.-l), cats("&rawdata.\", file_name));
     call symputx('dsetdbf'||put(count, 4.-l), scan(file_name, 1, '.'));
     if end then call symputx('max', count);
     run;

   %do i=1 %to &max;
     proc import datafile="&&readdbf&i"
       out=derived.&&dsetdbf&i 
       dbms=dbf
       replace;
       run;
   %end;

%mend readindbf;

edit:

I have tried setting: option validvarname=ANY in my autoexec file, which according to here should allow up to 32 byte length names, but it still truncates my names.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent