SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yura2301
Quartz | Level 8

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 cool:) procedure or smart soulution that allow solve the task?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

"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

4 REPLIES 4
Ksharp
Super User

"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

Yura2301
Quartz | Level 8

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!

Ksharp
Super User

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

Yura2301
Quartz | Level 8

Hi Ksarp,

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

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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