Hello,
I am trying to combine imported datasets using macro but i get warning below
WARNING: Multiple lengths were specified for the variable A by input data set(s). This can cause
truncation of data.
Note that var A has different length format automatically assigned during the import procedure.
below is my code.
%macro combine;
data c;
set
%do i = 1 %to 2;
&library..&&file&i
%end;
;
run;
%mend;
%combine;
Explicitly define the lengths of the offending variable(s) to their predetermined maximum value (eg. 60 chars)
%macro combine;
data c;
length problemvar $60;
set
%do i = 1 %to 2;
&library..&&file&i
%end;
;
run;
%mend;
%combine;
Explicitly define the lengths of the offending variable(s) to their predetermined maximum value (eg. 60 chars)
%macro combine;
data c;
length problemvar $60;
set
%do i = 1 %to 2;
&library..&&file&i
%end;
;
run;
%mend;
%combine;
This works fine. Thanks much.
Do not fix this here, prevent it when the data is imported in the first place. Do not use proc import, use a custom data step to read data, where you control all variable attributes.
See Maxims 31 and 22. Avoid Excel Files, convert to CSV first.
Hi Kurt,
This is noted.
I have changed my import to data step and made use of csv file.
Thanks.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.