BookmarkSubscribeRSS Feed
NewmanChow
Fluorite | Level 6

Hello,all:

When I use XML Engine to read and wirte a xml file.I found the issue.

libname test xml "xmltest.xml";
DATA a;
  X="2:2:1";
  output;
  X="3:3:1";
  output;
Run;

DATA test.a;
  set a;
run;

data b;
  set test.a;
Run;

libname test clear;

X in a is Character,X in b is DateTime.

Any options can retain the X as character in b?

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Is this an article or a question? If this is a question, then it doesn't belong here. Also, if this is a question, you have 2 objects named "a" -- you have the SAS dataset WORK.A and you have the TEST.A XML file that you create with the XML libname engine. In your "article" you say that "X in a is Character, X in b is DateTime". When you refer to just a, I think of WORK.A -- do you mean that X created in WORK.A is character??? Where is the rest of your article???

cynthia

PS...have you tried a LENGTH statement when you create WORK.B???

data b;

  length x $5;

  set test.a;

run;

NewmanChow
Fluorite | Level 6

Hi,Cynthia:

    This is a question. Sorry,I didn't pay attention to make sure It's a Article or Querstion .Can It be modified to correct?

'X in a is Character' which 'a' is WORK.A .

I tried your advice but got a error:

ERROR: Variable x has been defined as both character and

       numeric.

Sorry , again.

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