BookmarkSubscribeRSS Feed
Ksharp
Super User

NO. I mean a XML file.

 

I am curious that you can use PROC HTTP to download that XML file, Why can't you use FILENAME+URL ?

jei
Quartz | Level 8 jei
Quartz | Level 8

I can't attach the xml file. So I provided a screenshot instead

 

1.JPG

Ksharp
Super User

No. It is problem about encoding. You have to post a XML file if you want some help.

Did you try my another code ?

jei
Quartz | Level 8 jei
Quartz | Level 8

Yes I tried your another code but the same error.

 

I really appreciate your help. Thank you very much.

Attached is the XML file

Ksharp
Super User

I used Notepad++ open that XML , it shows it is UTF-8 encoding ,not UTF-16LE .

I ran my code again, No Error show up .

NOTE: I use University Edition(utf-8 encoding). Maybe you could use Notepad++ to transform the encoding , or change SAS session encoding.

 

filename xx temp;
libname xx xmlv2 '/folders/myfolders/ClientDetails.xml'  automap=replace xmlmap=xx;
proc copy in=xx out=work;
run;

 

x.png

 

Here are three tables I got :

 

y.png

 

jei
Quartz | Level 8 jei
Quartz | Level 8
Thank you! This is helpful but how will I get the XML directly from the site?
Ksharp
Super User

I don't know . If you are not able to get it by URL or PROC HTTP, maybe by your hand .

Ksharp
Super User

Or try this one :

 

FILENAME outfile "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml";
filename y url 'https://rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true';
data _null_;
infile y encoding='UTF-16LE' lrecl=32767;
input;
file outfile encoding='UTF-8';
put _infile_;
run;


filename xx temp;
libname xx xmlv2 'C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml'  automap=replace xmlmap=xx;
proc copy in=xx out=work;
run;
Reeza
Super User

Did you copy and paste? Sometimes the browsers add things. Try typing it out. 

jei
Quartz | Level 8 jei
Quartz | Level 8
I typed it and I am also log in to the site
Reeza
Super User

Do you need to log in to the site to generate the XML file?

Ksharp
Super User
filename xx temp;
libname xx xmlv2 '/folders/myfolders/LabReviewMicroSampleData.xml'  automap=replace xmlmap=xx;
proc copy in=xx out=work;
run; 
jei
Quartz | Level 8 jei
Quartz | Level 8
Hi @Ksharp,

As what I understood of a copy procedure is that it only copies the files. May I ask if it can also generate the XML file?
Ksharp
Super User

No. That is not going to genereate XML as you describe . I think you have to download XML file and import it into SAS .

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 28 replies
  • 1914 views
  • 0 likes
  • 3 in conversation