BookmarkSubscribeRSS Feed
ajaybetham
Calcite | Level 5

I am researching on how to compare 2 RTF files. There are many solutions. I don't find the one I am looking for. 

My thought process was to convert the 2 RTF files into 2 datasets and compare the datasets using proc compare. Is this the right approach. If yes, how to convert a RTF file to Sas dataset?

5 REPLIES 5
ChrisBrooks
Ammonite | Level 13

A lot depends on the layout of your RTF files - there's a paper here -> http://www2.sas.com/proceedings/sugi31/066-31.pdf describing one method. On the other hand if you have a simple RTF you could open it in Word and copy/Paste it into Excel then save the Excel file as a CSV which would be easy to import into SAS

ajaybetham
Calcite | Level 5

how to compare 2 RTF files programmatically

ChrisBrooks
Ammonite | Level 13

That’s a much more complex problem - you could open them and read them byte by byte but what if they differ in a trivial way e.g. an extra blank line in one of the files? Would younwant the comparison to re-synchronise?

LinusH
Tourmaline | Level 20

Why use SAS for this? 

SAS is great for working with data, not document objects.

I'm pretty sure that there are other 3rd party tools out there that can do that kind of comparisons (and then perhaps SAS can read the output from that...).

A Google search give me 542K results....

Data never sleeps
ajaybetham
Calcite | Level 5
That makes sense. I found some Java utils to compare RTF files. will go with Java.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4115 views
  • 0 likes
  • 3 in conversation