581 options varlenchk=nowarn;
582 proc append base=varImphsp data=work.bs_varImphsp force nowarn;
583 run;
WARNING: Variable variable has different lengths on BASE and DATA files (BASE 32 DATA 3).
How to remove the warning?
So use a DATA step to make the structures consistent.
data base;
length name $20 ;
stop;
run;
data new;
input name :$10. ;
cards;
Joe
Sam
;
data new2;
set base(obs=0) new;
run;
proc append base=base data=new2 ;
run;
The data step could be a view.
The data step will still generate a warning if the new dataset defines the variables as LONGER than the target dataset.
Make the data structures match.
Why are they different now? How did you create the original (BASE) dataset? How did you create the new (DATA) dataset?
That is one of the problems with using ODS OUTPUT to generate datasets. The structure is not consistent as it depends on the values that the procedure wants to DISPLAY for this analysis.
If you switch to using actual OUT= datasets (if available in the PROC(s) you are using) then the structure will be more consistent.
You will want to define a structure and use that. Probably best to define it before the first iteration of the loop.
That might be enough. Just make sure to define the character variables long enough for all possible values.
data base ;
length .....
stop;
run;
%do .....
ods output mystat = next ;
...
proc append base=base data=next force;
run;
%end;
Hi Tom,
This is exactly my current solution. The proc append would issue the WARNING.
data base;
length .....;
set first_data;
run;
.......
/*except the first data*/
proc append base=base data=data force;
run;
The purpose of using the proc append is about efficiency. But now, I think that there is unnecessary to think about the efficiency since the ODS output datasets are small. So, instead of proc append, I will use the data step.
data base_set;
set base_set data_set;
run;
Add the NOWARN option to suppress the warnings.
proc append base=base data=next force nowarn ;
So use a DATA step to make the structures consistent.
data base;
length name $20 ;
stop;
run;
data new;
input name :$10. ;
cards;
Joe
Sam
;
data new2;
set base(obs=0) new;
run;
proc append base=base data=new2 ;
run;
The data step could be a view.
The data step will still generate a warning if the new dataset defines the variables as LONGER than the target dataset.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: