BookmarkSubscribeRSS Feed
jei
Quartz | Level 8 jei
Quartz | Level 8

Hi!

 

I'm using the code below to generate the XML file from API and I want to save it to C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml as an xml file. But after the execution the windows explorer of the path just popping up and no file was created

 

May I know what is the best way to save the xml file in my computer?

Thank you!

x "curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml";

 

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What happens when you run the command:

curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml

From the command prompt?  Its likely you, or the place where SAS is installed is missing a permission, or the location.  You can try:

filename tmp pipe 'curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml';

data test;
  length buff $2000;
  infile tmp dlm="¬";
  input buff $;
run;
  

That should get the messages back from the system.  Maybe there is no path like that on C: (which is where SAS is installed not necessarily your local machine) or maybe you (or the SAS install) doesn't have permission to access that https site.

jei
Quartz | Level 8 jei
Quartz | Level 8

Hi @RW9,

 

When using the X statement, the command shows the exact details of the XML file. That is, we have a peermission to access the https. Do you know where I can check the SAS missing permission that you are saying? 

 

Also, the log resulted 0 obs using the filename pipe as the image shows.Capture.JPG

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would check with your IT group.  It sounds like SAS is installed on a network, and may need to be given the same permissions as your local machine.  

jei
Quartz | Level 8 jei
Quartz | Level 8
SAS was installed only on my local computer and have an Administration account.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Two other things you could try - turn xwait on:

options xwait;

Any OS window that opens will not close automatically, so you may see further information.  Also try running it from %sysexec:

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000171045.htm

 

And just to check again, if you goto the OS window, and run that command it does work?  It just seems strange as SAS local would just push the text out to the OS to run, so it should be exactly the same.

Also, you have spaces inside the path (never recommended!) so you might need to quote the path (i have quoted both the https and path, try either if that doesn't work):

x 'curl -k "https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true" > "C:\Users\Desktop\Sample1\From URL\curl\savedfile.xml"';

 

Ksharp
Super User

If you could run

 

x "curl -k https://root:Tr3nd512345@rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true > want.xml";

 

then  WANT.XML should be under the same  folder/directory with curl.exe , Check Where CURL is installed .

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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