1
votes

I'm having some trouble updating code to work with SAS 9.4, Proc Import specifically. I have a bunch of messy data that I specified "getnames=no" for. In 9.3, the default column names were F1, F2, F3, etc. I then have a bunch of code to clean up the data, rename variables, etc.

In 9.4, the default column names are A, B, C, etc. so none of my old code works. Is there a setting or option I can change to use the F1, F2, F3 naming convention instead of A, B, C?

Thanks.

1
What did the documentation say regarding this change?data _null_
I can't find anything indicating that there was a change. I'm moving from base 9.3 SAS on a PC to 9.4 SAS Studio on a server so there are several moving parts. It may not be a code issue at all.Brandon Booth
I've been looking too but have not found anything. Do some searching at support.sas.com use notes, examples, etc. maybe you will find something. You "can" code gen a rename pretty easily, if you have to go that route and need help post another question.data _null_
Put some code in your question, that would help. Did you change DBMSs to XLSX from EXCEL for example? Or do you not specify DBMS at all?Joe
And- what kind of server?Joe

1 Answers

0
votes

Why not use a PROC DATASETS to rename all the variables? You can use PROC CONTENTS plus PROC SQL to create the RENAME statement.

PROC CONTENTS DATA=imported OUT=impcont NOPRINT ;
RUN ;

PROC SQL ;

  SELECT COMPRESS(name || '=f' || PUT(varnum,3.))
    INTO :renamestmt SEPARATED BY ' '
    FROM impcont
  ;

QUIT ;

PROC DATASETS LIBRARY=work NOLIST ;
  MODIFY imported ;
    RENAME &renamestmt ;
  RUN ;
QUIT ;