BookmarkSubscribeRSS Feed
Jacob1602
Calcite | Level 5

I have a file that are extreamly large. Larger the 32.000.

 

I need SAS to read it, and the way i want it to do so is, that I expect to infile the first 32.000 bytes fine my tang <tag01> Then I will extract a new subset of the file starting with <tag01> and extracting to <tag02>, thereafter extract form <tag02> to <tag03> and so forth.

 

Thereafter I will drop som of the extracted segments and rebuild the file again. What I will leave out is some databloks, that are extreamly large, and when I rebuild the file the size is less the 32000.

4 REPLIES 4
Ksharp
Super User

It looks like it is a XML file . Try XMLV2 engine.

 

libname x xmlv2 '/folders/myfolders/xx.xml' automap=replace xmlmap='/folders/myfolders/xx.map';
Jacob1602
Calcite | Level 5

Thanks for the advise, and you are totally right, it is a xml file. The problem is, that the file is to big for the SAS xml engine due to very big tatabloks. Therefore I will recuce the xml file by extracting the databloks and inserting a surogat-key instead. Thereby, when I read the xml file, I have a perfect dimensional model, with the databolks as my fact and the other datasets from the xml as my dimensions.

 

We are an organisation that is very SAS centric, therefore I will prefere to stick to SAS code. 

Ksharp
Super User
It is NOT good for hard coding . If your XML is quite simple, you don't need too much code. But it is complicated ,I am afraid that would be very hard for SAS coding .
RW9
Diamond | Level 26 RW9
Diamond | Level 26

As @Ksharp has stated it sounds like you are working with XML files.  I would not recommend you try to read and modify these yourself, you can use the libname as @Ksharp has provided, and for more complex XML then the XML Mapper.  However to properly work with XML data you would be far better off using software built to work with XML.  There are plenty of paid/free ones out there:

https://en.wikipedia.org/wiki/Comparison_of_XML_editors

XMLFox springs to mind.  These allow you to alter/query/update XML files as if they were a database, i.e. searhing for tags, removing blocks etc.

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