BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Paul_NYS
Obsidian | Level 7

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):(Column).

      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

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

2 REPLIES 2
art297
Opal | Level 21

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.

Paul_NYS
Obsidian | Level 7

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

Paul

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
  • 2 replies
  • 2694 views
  • 0 likes
  • 2 in conversation