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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.