DDE can read that data!
I looked at the first two options in the excel dialog
As an XML table it creates a schema and a new workboot with references, like Excel|[Book2]Sheet1
After selecting the data area and copying to the clipboard, SAS sees the DDE triplet as
'Excel|[Book2]Sheet1!R1C1:R37C6'
When selecting "As a read-only workbook", the object references retain more of the original names and the clipboard triplet becomes
Excel|http://www.w3schools.com/xml/[plant_catalog.xml]plant_catalog!R1C1:R38C7
Once you open the XML as a readonly workbook in excel, a sufficient data step to read this from base SAS on windows, is
data ;
infile
'Excel|http://www.w3schools.com/xml/[plant_catalog.xml]plant_catalog!R1C1:R38C7'
device=dde notab lrecl=1000 dsd dlm='09'x truncover ;
input (col1-col8)($) ;
run;
Those who seek an even more general approach can remove the "row reference" allowing DDE to load as many rows as are present and up to 255 columns, with the triplet
Excel|http://www.w3schools.com/xml/[plant_catalog.xml]plant_catalog!C1:C255
The data step above provides just the first 8 characters of each column, but enough to demo the principle. To load wider, change the ($) in the INPUT statement to (:$30.)
Always use TRUNCOVER to deal with short lines and DSD to skip empty cells
It does show interesting differences when comparing these two presentations from excel.
It also points out what we might hope for in the next release of improvements to SAS XML LIBNAME engines
That "we can" does not mean that "we should", as the number of ways that DDE can disappoint are many!
Thought I should update this to point out that the AUTOMAP option has indeed been added to the SAS XML Libname engine. See SAS(R) 9.4 XML LIBNAME Engine: User's Guide
While automapping make pretty decent "best guess" at how the data should be structured, it may not always bring in data structured the way you like.
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.
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.