BookmarkSubscribeRSS Feed
aarony
Obsidian | Level 7

when i merge 2 files i get:

WARNING: Multiple lengths were specified for the BY variable cusip by input data sets. This

         might cause unexpected results.

i noticed that the fyear for two files are different.

file1: best12.

file2: 4.

how do i change one of the following, for ex: file2's 4. to best12.?

2 REPLIES 2
ballardw
Super User

Issue is not format but the actual number of bytes used to store the variable in the two datasets.

If you run proc contents or examine the variables in the Explorer you will see that the LENGTH is different.

Without rebuilding the data sets generally a good approach would be to have the data set with the larger value for length first in a set or merge statement.

Or make a copy of the data set with the smaller value

data want;

     length cusip 8; /* guessing the set with the larger value of length for cusip is 8 as that is a default for numeric*/

     set file2; /* guessing this is the set with the smaller length*/

run;

and use want instead of file2.

arodriguez
Lapis Lazuli | Level 10

If you change the order of the datasets this warning will desapear.

Also if you change the format before the "set" with format var BEST12. it will be solved too.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 458 views
  • 0 likes
  • 3 in conversation