DATA Step, Macro, Functions and more

Warning for multiple lengths

Accepted Solution Solved
Reply
Regular Contributor
Posts: 216
Accepted Solution

Warning for multiple lengths

Hi

When I run the below data step, which is the final step in a section of code, I am getting the below warning for potential truncation. Is this warning due to defining the lengths of the variables in the Length statement? The process does create the resulting s1AgeClean file in the work directory (for some reason, the result does not show up in the Enterprise Guide 'Results' tab though)

Paul

data s1AgeClean (rename=(COUNT=DistributiveNumber agecat4b=agecat4));

length cnty_name $ 25 startyear 3 exit $ 17 agecat4 3 agecat4b $ 10 exitMonthCategory 3 CohortYearTotal 5 CohortYearTotalAge 5 COUNT 5 DistributivePercent 5 CumulativeNumber 5 CumulativePercent 5;

set s1ageyear1New;

DistributivePercent=COUNT/CohortYearTotalAge;

CumulativePercent=CumulativeNumber/CohortYearTotalAge;

if exitMonthCategory ne 72;

if exit="XCA" then exit="Adoption";

if exit="XRF" then exit="Reun/Cust/Guard";

if exit="XRM" then exit="Aged Out";

if exit="XOT" then exit="Other Exit";

if agecat4=1 then agecat4b="0";

if agecat4=2 then agecat4b="1 to 5";

if agecat4=3 then agecat4b="6 to 12";

if agecat4=4 then agecat4b="13 to 17";

if agecat4=5 then agecat4b="18 +";

drop agecat4;

run;

WARNING: Multiple lengths were specified for the variable startyear by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable CohortYearTotal by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable agecat4 by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable exitMonthCategory by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable COUNT by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable DistributivePercent by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable CumulativeNumber by input data set(s). This may cause truncation of data.

WARNING: Multiple lengths were specified for the variable CohortYearTotalAge by input data set(s). This may cause truncation of data.

NOTE: Missing values were generated as a result of performing an operation on missing values.

      Each place is given by: (Number of times) at (Line)Smiley SadColumn).

      6192 at 197:26   6192 at 198:35  

NOTE: There were 47520 observations read from the data set WORK.S1AGEYEAR1NEW.

NOTE: The data set WORK.S1AGECLEAN has 44880 observations and 11 variables.

NOTE: DATA statement used (Total process time):

      real time           0.03 seconds

      cpu time            0.01 seconds


Accepted Solutions
Solution
‎11-23-2012 09:29 AM
PROC Star
Posts: 7,363

Re: Warning for multiple lengths

Paul,  That is precisely why I like to use retain, rather than length, to reorder variables.  Only you know your data and whether the warning is serious.  However, that said, reducing the length of numeric variables can be quite risky unless one has a firm understanding of the number of bytes that are actually required for the precision that will be needed.

View solution in original post


All Replies
Solution
‎11-23-2012 09:29 AM
PROC Star
Posts: 7,363

Re: Warning for multiple lengths

Paul,  That is precisely why I like to use retain, rather than length, to reorder variables.  Only you know your data and whether the warning is serious.  However, that said, reducing the length of numeric variables can be quite risky unless one has a firm understanding of the number of bytes that are actually required for the precision that will be needed.

Regular Contributor
Posts: 216

Re: Warning for multiple lengths

Yes Art, I know all the values, so it would not be a problem. Thanks a lot.

Paul

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 858 views
  • 0 likes
  • 2 in conversation