BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
robertrao
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

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.

robertrao
Quartz | Level 8

Okie..........

We get warnings about missing variables. Is that Right? Can we go ahead with those warnings ???????Can I ignore those warnings?????

Thanks

Tom
Super User Tom
Super User

Only you know what fields you require, so the decision to ignore the warning is yours.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 5831 views
  • 3 likes
  • 2 in conversation