306 data work.accounting;
307 set work.dept1
WARNING: Multiple lengths were specified for the variable jobcode by input data set(s). This may
cause truncation of data.
NOTE: There were 3 observations read from the data set WORK.DEPT1.
NOTE: There were 3 observations read from the data set WORK.DEPT2.
NOTE: The data set WORK.ACCOUNTING has 6 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.05 seconds
cpu time 0.03 seconds
The dataset WORK.DEPT1 appears first in the SET statement set work.dept1 work.dept2; wherein the SAS compiler assigns a length of 5 for the variable jobcode whose attributes cannot be change further in program. The log above shows a warning message for multiple lengths of the variable jobcode but all the values read from dataset WORK.DEPT2 are truncated to 5 characters. This is solely because of the order in which the datasets appear in the SET statement.
To change attributes of a variable, we would define the attributes first for said variable in the data step (e.g. LENGTH statement) and then proceed with the SET statement.
The one and only FREE resource for general SAS online training as well as study guides for the SAS Base Certification. My goal is to create the SAS Certification prep guide that I never found but always wanted. This should also be a place to come if you are new to the language but are simply looking for online SAS training.