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
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, 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.
Yes Art, I know all the values, so it would not be a problem. Thanks a lot.
Paul
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.
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.