BookmarkSubscribeRSS Feed
KasperMok
Calcite | Level 5

I never worked with XML data before, but are trying to make a loop that imports a folder full of XML files into SAS.

 

I took over the program below, but realises that I get a problem, when I have to import other variables from the file then the two already in use, since some dont have a fixed length.

 

%macro loop;

%do n=1 %to &no;

data import;

infile "Z:\&&filnavn_&n" LRECL=9999 SCANOVER;
input @'<Review>' +9 medlemnr $9. +20 artikel $10.@@;

run;

proc append base = lookup.review_01 data = import; run;

%end;

%mend loop;

%loop;

 

Any sugestions?

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You would be better off looking at the SAS XML Mapper software and the libname xml, rather than trying to write an XML parser yourself:

http://support.sas.com/rnd/base/xmlengine/

 

KasperMok
Calcite | Level 5

Probably, but I dont think I have access to that solution, otherwise I would.

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
  • 3 replies
  • 790 views
  • 1 like
  • 2 in conversation