BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ethan1
Fluorite | Level 6
This xml file comes from 'Title.xlsx'. In order to import this xml file, I have created a mapper file(test.map). 

SAS code:
filename  xlsx2xml '~\xml-sas\Titles222.xml';
filename  SXLEMAP '~\xml-sas\test.map';
libname   xlsx2xml xmlv2 xmlmap=SXLEMAP access=READONLY;

data sheet;
  set xlsx2xml.final;
run;

The dataset I got is shown as data.png. I did some simple data processing to get what I want in the end like data1.png.

My question is, is there a way to add some code to the mapper file(test.map), so that I do not need these data processing in sas
and can directly get the dataset I want (data1.png)?

data.PNG

data1.PNG

  

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

You are over-complicating things. I got your intended result by doing this:

libname titles xlsx '/folders/myfolders/Titles.xlsx';

data want;
length sheet $32;
set titles.sheet: indsname=dname;
sheet = scan(dname,2,'.');
run;

View solution in original post

1 REPLY 1
Kurt_Bremser
Super User

You are over-complicating things. I got your intended result by doing this:

libname titles xlsx '/folders/myfolders/Titles.xlsx';

data want;
length sheet $32;
set titles.sheet: indsname=dname;
sheet = scan(dname,2,'.');
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 536 views
  • 0 likes
  • 2 in conversation