excelsasexportrename

Creating a SAS Column name with more than 32 Characters to be exported to Excel


I am trying to create a SAS table with a column name that has more than 32 characters. I will then export this SAS table to an Excel file, but I noticed that the maximum character length is 32 characters for a SAS column. Is there a way to create SAS column name with more than 32 characters, so that it can be exported to Excel with the 32+ characters long column name? Thanks for any help.


Solution

  • SAS cannot support column names over 32 characters, under any circumstances.

    You can use column labels, though, and ask them to be used as the Excel column names.

    data class;
      set sashelp.class;
      label name="Very Long Column Name That Is So Very Very Long";
    run;
    
    proc export data=class file="h:\temp\test_longnames.xlsx" dbms=xlsx replace label;
    run;