BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jei
Quartz | Level 8 jei
Quartz | Level 8

Hi!

 

I'm trying ti import an XML file using this script

filename outfile "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml" encoding= 'UTF-8';
libname source xml "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml";
proc http
	out = outfile
	url = 'https://rbc-svr-pi/webacs/api/v1/data/ClientDetai​ls?.full=true'
	method = 'get';
run;

 But an error occured.

 

 

1.JPG

 

May I know how to solve the error? Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

 

Mmm don't know what to say except that this web site really screws characters sometimes (but not always).

 

I get the same message as you but after cleaning I can run the code and I get the expected proc http error

 

ERROR: Host name resolution failed

 

To clean, delete every space and end-of-line character and add them manually again.

 

Run each line separately to see which one still contains bad characters.

 

 

 

View solution in original post

17 REPLIES 17
Ksharp
Super User

Can you change your SAS session's encoding  into utf-16le? in sas configure file ?

 

ChrisNZ
Tourmaline | Level 20

The error point to bad characters in the program itself. This very web site embeds such characters in posted programs.

Admins, anything you can do to avoid this?

 

Try this cleaned version:

 

filename outfile 'C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml' encoding='UTF-8';

libname source xml 'C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml';

proc http out=outfile url='https://rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true' method='get';run;

 

 

jei
Quartz | Level 8 jei
Quartz | Level 8
The error is still the same.
ChrisNZ
Tourmaline | Level 20

Grrr. Yes the rogue characters have been inserted again.

 

Try the attached file.

jei
Quartz | Level 8 jei
Quartz | Level 8
still the same.
ChrisNZ
Tourmaline | Level 20

 

Mmm don't know what to say except that this web site really screws characters sometimes (but not always).

 

I get the same message as you but after cleaning I can run the code and I get the expected proc http error

 

ERROR: Host name resolution failed

 

To clean, delete every space and end-of-line character and add them manually again.

 

Run each line separately to see which one still contains bad characters.

 

 

 

jei
Quartz | Level 8 jei
Quartz | Level 8

Hi @ChrisNZ

I retyped all and no error occured. But no data on the resuletd XML file as seen on the image below

2.JPG

 

May I know if you have any idea about resful API on sas and how to code it? I think the step on the link should follow in order to get the data.

https://developer.cisco.com/media/prime-infrastructure-api-reference-v3-0/192.168.115.187/webacs/api...

 

 

ChrisNZ
Tourmaline | Level 20

That's a a different issue. Now that this is solved and the code can run, best to open a new incident with the appropriate title so the right people can be involved.

jei
Quartz | Level 8 jei
Quartz | Level 8
Alright. Thanks!
Ksharp
Super User

Can you run OS command at SAS side ?

 

x 'curl -k "https://user:password@my_server/webacs/api/v1/data/Devices?.full=true"  >  C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml ';

Then run my code .

ChrisNZ
Tourmaline | Level 20

@Ksharp Sorry I didn't see your answer when I asked for the solved flag to be set. I didn't mean to discount your post.

Ksharp
Super User

Chris,

That is OK. I really don't care about that.

You must are using IE ? Try Chrome .

jei
Quartz | Level 8 jei
Quartz | Level 8
yes I'm trying this code
jei
Quartz | Level 8 jei
Quartz | Level 8

Hi @Ksharp,

 

I tried this code

x 'curl -k "https://user:password@my_server/webacs/api/v1/dat​a/Devices?.full=true"  >  C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.x​ml ';

It says that >C does not recognized.

 

 

and I tried only the

 

x 'curl -k "https://user:password@my_server/webacs/api/v1/dat​a/Devices?.full=true" >OutXML.x​ml ';

and it was successful. But I don't know where local file it was saved and when I'm searching it it says that no result found.

Do you have any idea where i can found the file?

 

Thank you!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 6294 views
  • 0 likes
  • 4 in conversation