DATA Step, Macro, Functions and more

Is it possible to "smart" and quick compare big xml files?

Accepted Solution Solved
Reply
Regular Contributor
Posts: 161
Accepted Solution

Is it possible to "smart" and quick compare big xml files?

Hi All,

I have the task - compare more-less big xml files(~200 kb-1 mb).

This files is formed by proc metadata, so all text stored in one line, that isn't very good becouse SAS can read 32767 characters from one line.

As result I'd like to have a fact:

if files absolutely the same or have some differents.

Off cource I can compare file size but obviously equal file size doesn't garanty that content of files are same...

May be there are some coolSmiley Happy procedure or smart soulution that allow solve the task?

Thanks!


Accepted Solutions
Solution
‎06-25-2012 10:32 PM
Super User
Posts: 10,044

Re: Is it possible to "smart" and quick compare big xml files?

"becouse SAS can read 32767 characters from one line."

Nor really. SAS can read more than 1G characters from one line. MikeZeba has already show it before at this forum.

About your question.

Did you consider using LIBNAME + XML to compare these xml files OR

you can directly use DATA STEP to compare them.

Ksharp

View solution in original post


All Replies
Solution
‎06-25-2012 10:32 PM
Super User
Posts: 10,044

Re: Is it possible to "smart" and quick compare big xml files?

"becouse SAS can read 32767 characters from one line."

Nor really. SAS can read more than 1G characters from one line. MikeZeba has already show it before at this forum.

About your question.

Did you consider using LIBNAME + XML to compare these xml files OR

you can directly use DATA STEP to compare them.

Ksharp

Regular Contributor
Posts: 161

Re: Is it possible to "smart" and quick compare big xml files?

Hi Ksharp,

Approach Libname +XML isn't ok in my case becouse this one-row xml file is actually formed by proc metadata and I already use libname XML + different xmlmaps for extracting neeeded info from this source xml file(formed by proc metadata).

But your first advise(about solution provided by MikeZdeb:lrecl>32767+ dsd and pad options) were perfect, actually what I need.

May be someone will be interested in the Mike code:

data new;

infile 'z:\names.txt' dsd lrecl=50000 pad;

input name : $15. @@;

run;


Thanks!

Super User
Posts: 10,044

Re: Is it possible to "smart" and quick compare big xml files?

Hi. Or you can change the format of record, that also can settle this problem.

data new;

infile 'z:\names.txt' dsd recfm=n;

input name : $15. @@;

run;

Ksharp

Regular Contributor
Posts: 161

Re: Is it possible to "smart" and quick compare big xml files?

Hi Ksarp,

Thanks for one more variant , I'll look also into it.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 233 views
  • 0 likes
  • 2 in conversation