The SAS Output Delivery System and reporting techniques

formatting variable length when importing from Excel

Not applicable
Posts: 1

formatting variable length when importing from Excel

i'm trying to perform a one to one merge to link two datasets with a uniqueid (common key) that is a text veriable. these data currently reside as two separate Excel files and i use the IMPORT function.

the issue i've encountered is that in one dataset the uniqueid is 8 characters long and in the other it is 30 characters long (excel formatting?). is there a way to specify var length when importing data from an excel file?

thanks in advance.
Posts: 9,371

Re: formatting variable length when importing from Excel

Hi, Dawn:
When you import from Excel into SAS, you are probably using PROC IMPORT or the Libname engine for Excel. Neither of those methods has any involvement with ODS.

Your best bet for figuring out import issues is to contact Tech Support. They can determine which method you are using and can advise you on the best method to use to get your var length set correctly. Since you are programming a merge, Tech Support can also help you figure out whether a simple LENGTH statement would work or whether there's a different method that works better.

Generally speaking, in a merge, if you list the file with the longer variable in the merge statement first, SAS uses that length for the length in the merged file. But there may be other issues with the particular technique that you're using. Tech Support could help with that.

To find out how to contact Tech Support, refer to:
Good Luck!
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation