BookmarkSubscribeRSS Feed
kajal_30
Quartz | Level 8

Hi,

 

I am using Proc compare and want to create a table which has all the diff values only for column 

eg: we have a

table_1 with columns: A,B,C,D,E

table_2 with columns : A,B,C,D,E

output_table should have A,B,C,D,E (comparing table_1 and table_2 only for variable B and D) 

 

Hope this helps

 

Thanks

Kajal

 

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

"comparing table_1 and table_2 only for variable B and D". What does this mean? What observations would output_table contain?

ballardw
Super User

The VAR statement restricts which variables are compared. So I suspect you may be looking for

 

VAR B D;

 

I am not sure if by "output table" you mean a data set or not.

kajal_30
Quartz | Level 8

Yes, I am referring to data set. My concern is if I put var then it will give me comparison for the columns in Var statement but it will exclude rest of the columns from  out put which I need.

Comparing data set only for one column retaining all other columns in the output.

 

Thanks

Kajal

ballardw
Super User

@kajal_30 wrote:

Yes, I am referring to data set. My concern is if I put var then it will give me comparison for the columns in Var statement but it will exclude rest of the columns from  out put which I need.

Comparing data set only for one column retaining all other columns in the output.

 

Thanks

Kajal


I suspect we are having issues if English is not your native language. The above sort of contradicts your original problem description.

output_table should have A,B,C,D,E (comparing table_1 and table_2 only for variable B and D) 

which says you only want to compare B and D.

 

Best at this point would be to provide small examples of data sets table_1 , table_2 and what the desired output should look like for those examples. Provide examples of the kind of matches/ difference you expect to see. Each set should likely only need 10 or 15 rows of data. Provide the data as data step code such as:

data table_1;
  input a b c d e;
datalines;
1 2 3 4 5
2 3 4 5 6
;

Test the code to make sure that it creates data sets. Then Paste the code into a code box opened with the {I} or "running man" icons at the top of the forum message box to preserve correct formatting so the code runs. The message windows on this forum will reformat text and sometimes code pasted in the main windows will not run as pasted and reformatted.

SAS Innovate 2025: Call for Content

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 675 views
  • 0 likes
  • 3 in conversation