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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 828 views
  • 0 likes
  • 2 in conversation