Hi ,
I have two datasts and want to append them together( variable attributes are same in both the datasets)
DATASET1(BASE=)
ID IN1 OUT1 IN2 OUT2 IN3 OUT3 IN4 OUT4
DATASET2(DATA=)
ID IN1 OUT1 IN2 OUT2
When I try to append these two datasets I get messages in the LOG that
IN3 is not initialized
OUT3 is not initialized
IN4 is not initialized
OUT4 is not initialized
Should I use Force Option????
BUT I READ FROM DOCUMENTATION
"You must use the FORCE option with PROC APPEND when the DATA= data set contains a variable that is not in the BASE= data set. If you modify the program to include the FORCE option, then it successfully concatenates the files.
THAT IS NOT THE CASE WITH ME.....
DATA=dataset contains common variables always but not as many as those in the BASE dataset
Thanks
FORCE doesn't apply in this case. You will not get "uninitialized" messages, but you will get warnings about the missing variables.
Here is some example data:
data one two (keep=id in1 out1 in2 out2);
input (id in1 out1 in2 out2 in3 out3 in4 out4) (1.);
cards;
123456789
;
proc append base=one data=two ;
run;
NOTE: Appending WORK.TWO to WORK.ONE.
WARNING: Variable in3 was not found on DATA file.
WARNING: Variable out3 was not found on DATA file.
WARNING: Variable in4 was not found on DATA file.
WARNING: Variable out4 was not found on DATA file.
NOTE: There were 1 observations read from the data set WORK.TWO.
NOTE: 1 observations added.
NOTE: The data set WORK.ONE has 2 observations and 9 variables.
If you reverse the two datasets then you will need the FORCE option, but the extra variables will NOT be added to the base dataset.
proc append base=two data=one force ;
run;
NOTE: Appending WORK.ONE to WORK.TWO.
WARNING: Variable in3 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable out3 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable in4 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable out4 was not found on BASE file. The variable will not be added to the BASE file.
NOTE: FORCE is specified, so dropping/truncating will occur.
NOTE: There were 1 observations read from the data set WORK.ONE.
NOTE: 1 observations added.
NOTE: The data set WORK.TWO has 2 observations and 5 variables.
FORCE doesn't apply in this case. You will not get "uninitialized" messages, but you will get warnings about the missing variables.
Here is some example data:
data one two (keep=id in1 out1 in2 out2);
input (id in1 out1 in2 out2 in3 out3 in4 out4) (1.);
cards;
123456789
;
proc append base=one data=two ;
run;
NOTE: Appending WORK.TWO to WORK.ONE.
WARNING: Variable in3 was not found on DATA file.
WARNING: Variable out3 was not found on DATA file.
WARNING: Variable in4 was not found on DATA file.
WARNING: Variable out4 was not found on DATA file.
NOTE: There were 1 observations read from the data set WORK.TWO.
NOTE: 1 observations added.
NOTE: The data set WORK.ONE has 2 observations and 9 variables.
If you reverse the two datasets then you will need the FORCE option, but the extra variables will NOT be added to the base dataset.
proc append base=two data=one force ;
run;
NOTE: Appending WORK.ONE to WORK.TWO.
WARNING: Variable in3 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable out3 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable in4 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable out4 was not found on BASE file. The variable will not be added to the BASE file.
NOTE: FORCE is specified, so dropping/truncating will occur.
NOTE: There were 1 observations read from the data set WORK.ONE.
NOTE: 1 observations added.
NOTE: The data set WORK.TWO has 2 observations and 5 variables.
Okie..........
We get warnings about missing variables. Is that Right? Can we go ahead with those warnings ???????Can I ignore those warnings?????
Thanks
Only you know what fields you require, so the decision to ignore the warning is yours.
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.