Hi Team,
While appending the datasets using proc append with the Force option, one variable is of different length in the source and target.
I am getting the warning message that of varying lengths and the values has been truncated for this variable.
WARNING: Variable Cur_City has different lengths on BASE and DATA files
(BASE 22 DATA 50).
NOTE: FORCE is specified, so dropping/truncating will occur.
Also checked using the Proc Print, the values of curr_city has been truncated.
I can't use the options varlenchk=nowarn as it is unacceptable for the warnings to suppress in the Live environment.
Can anyone suggest the ideas on how to proceed further without the truncated values and warnings.
Thanking You,
Siddhu1
Change the length of the variable in the BASE data set to 50, before you run PROC APPEND.
As Paige said , change the variable length in DATA file.
But make sure you would not lost any information in Cur_City .
data have;
set sashelp.class;
run;
proc sql;
alter table have
modify name char(22);
quit;
@Ksharp wrote:
As Paige said , change the variable length in DATA file.
I said the opposite, change the length in the BASE data set.
Or use a data step:
data new_base;
if 0 then set append; /* gets length from new dataset, but does nothing else */
set
base
append
;
run;
Down side to this approach is APPEND doesn't process the base data, where as datastep will
So if you only need to append a few observations to a large base dataset then data step will be less efficient.
@AMSAS wrote:
Down side to this approach is APPEND doesn't process the base data, where as datastep will
So if you only need to append a few observations to a large base dataset then data step will be less efficient.
Yes, but if you need to adapt the base dataset to a new structure anyway (as in this case), the data step does both actions in one step.
Then we need some coding that reads the max length from dictionary.columns and builds a LENGTH statement to use in place of the IF 0 THEN SET.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.