BookmarkSubscribeRSS Feed
dbrownin
Calcite | Level 5
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.
dawn
1 REPLY 1
Cynthia_sas
Diamond | Level 26
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:
http://support.sas.com/techsup/contact/index.html
Good Luck!
cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 972 views
  • 0 likes
  • 2 in conversation