DATA Step, Macro, Functions and more

warning: multiple lengths were specified for variable X

Reply
Occasional Contributor
Posts: 18

warning: multiple lengths were specified for variable X

When I try to transform a work.dataset to a sas.dataset I get the following warning:
 
WARNING: Multiple lengths were specified for the variable JU by input data set(s). This can cause
truncation of data.
 
The work data set (WIO) consists of 2467 columns and 36960 rows. The library reference is IIOdat.
 
Code:
%macro setlist;
%do i=2000 %to 2014;
WIO&i
%end;
%mend setlist;
data IIOdat.WIO;
set %setlist;
run;
 
Log:
56 %macro setlist;
57 %do i=2000 %to 2014;
58 WIO&i
59 %end;
60 %mend setlist;
61
62 data IIOdat.WIO;
63 set %setlist;
64 run;
 
WARNING: Multiple lengths were specified for the variable JU by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable OC by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable SK by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable UO by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable ABA by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable AFI by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable AJQ by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable ALU by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable AQC by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable AUG by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable AWO by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable AYS by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BAW by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BFE by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BHI by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BJM by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BNI by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BNM by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BNU by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BSC by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable BWK by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable CHE by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable CJI by input data set(s). This can cause
truncation of data.
WARNING: Multiple lengths were specified for the variable CNL by input data set(s). This can cause
truncation of data.
NOTE: There were 2464 observations read from the data set WORK.WIO2000.
NOTE: There were 2464 observations read from the data set WORK.WIO2001.
NOTE: There were 2464 observations read from the data set WORK.WIO2002.
NOTE: There were 2464 observations read from the data set WORK.WIO2003.
NOTE: There were 2464 observations read from the data set WORK.WIO2004.
NOTE: There were 2464 observations read from the data set WORK.WIO2005.
NOTE: There were 2464 observations read from the data set WORK.WIO2006.
NOTE: There were 2464 observations read from the data set WORK.WIO2007.
NOTE: There were 2464 observations read from the data set WORK.WIO2008.
NOTE: There were 2464 observations read from the data set WORK.WIO2009.
NOTE: There were 2464 observations read from the data set WORK.WIO2010.
NOTE: There were 2464 observations read from the data set WORK.WIO2011.
NOTE: There were 2464 observations read from the data set WORK.WIO2012.
NOTE: There were 2464 observations read from the data set WORK.WIO2013.
NOTE: There were 2464 observations read from the data set WORK.WIO2014.
NOTE: The data set IIODAT.WIO has 36960 observations and 2467 variables.
NOTE: DATA statement used (Total process time):
real time 48.26 seconds
cpu time 20.61 seconds
 
What does this mean, and what can I do with it?
 
All help is very appreciated.
Contributor
Posts: 52

Re: warning: multiple lengths were specified for variable X

The problem seems to be with the way the datasets(2000-2014) are created. the length ogf variables are set once the first dataset is appeneded to the IIOdat.WIO.

 

Please do the proc datset on one or 2 of the dataset and see if the length is same for these variables.


Cheers from India!

Manjeet
Contributor
Posts: 22

Re: warning: multiple lengths were specified for variable X

These errors are shown because of the way the output data set is getting created.

 

For the first time when output dataset is created from first input dataset, it sets all variable attributes (their lengths and types) from this dataset. When the same is repeated, it is not matching with the existing information that output data set has set in it's PDV.

 

As an alternative, you can use the LENGTH statement in the beginning for the variables being shown in the log, so that you get a fixed length for those variables in output dataset and then try.

Ask a Question
Discussion stats
  • 2 replies
  • 295 views
  • 0 likes
  • 3 in conversation