BookmarkSubscribeRSS Feed
radha1
Calcite | Level 5

Hi,

 

I compared two data sets, want to keep the compared data in one table.

 

can anyone help me how to display compared data in tabular format in SAS EG.

 

 

Thanks in Advance.

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

From the manual:

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n1f136xdchlfrtn1663tm...

 

specify out= 

and give a dataset name to store the output.

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

Please post the SAS code that you are having problems with.  Also include you SAS log.

Lots of SAS code and examples are available online, but you should show your attempts at resolving the problem first so that the experts can help guide.

 

Astounding
PROC Star

If you are not getting much of a response to your question, it's probably because you left out most of the important information.  Here's what you should describe, and not leave to our imagination.

 

"I compared two data sets"

 

  • Are they SAS data sets?
  • How did you compare them?

 

"want to keep the compared data"

 

  • All the data was compared.  So what exactly do you want to keep?  Give the details.  All of them.

 

"in one table"

 

  • In one Excel spreadsheet?  In one SAS data set?  In one DMBS table?

 

"display the compared data"

 

  • At this point, nobody knows what the compared data is, and nobody knows what type of display you would like.
radha1
Calcite | Level 5

Thanks for the response,

 

how to print proc compare results as table or html.

 

the below data have display in html or table format:

 

 

Variables Summary
Number of Variables in Common: 3.
Observation Summary
Observation Base Compare
First Obs 1 1
Last Obs 4 4
Number of Observations in Common: 4.
Total Number of Observations Read from
WORK.DEMOG: 4.
Total Number of Observations Read from
WORK.COMPARE: 4.
Number of Observations with Some Compared Variables
Unequal: 0.
Number of Observations with All Compared Variables
Equal: 4.
NOTE: No unequal values were found. All values
compared are exactly equal.

 

 

Thanks

Astounding
PROC Star

The most flexible way would add this statement before running PROC COMPARE:

 

ods trace on;

 

Then you can see notes in the log about all the pieces of output that ODS stores.  You can capture the ones you want as SAS data sets using multiple ODS OUTPUT statements.

 

Each piece can then be printed using a simple PROC PRINT.  You can add as much formatting as you would like, when it comes time to print.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1337 views
  • 1 like
  • 4 in conversation