BookmarkSubscribeRSS Feed
peterluan
Calcite | Level 5

Usually, we click on ‘LIST’ tab on a website then ‘Export to Excel’ and save as xlsx file. This will give us the right report, but it’s a manual process. Can we automate this process through PROC HTTP?

 

I have tried the following. It will run, but it's does not give me the right table:


%LET RootFileDirectory = C:\Users\xxxx\prod\data;
FILENAME sp_tprm  "&RootFileDirectory\sp_tprm.json";/*  sp_tprm */
%LET RESTBaseURL=http://xxxxxx.net/sites/yyyyy-038/_api;
PROC HTTP   
    URL= "&RESTBaseURL./lists/getbytitle('Category-Managed Third Party Request')/items?$top=3000"
 OUT=sp_tprm
   AUTH_NTLM METHOD="GET";
   headers 'accept' = 'application/json;odata=verbose';
RUN;

2 REPLIES 2
ChrisHemedinger
Community Manager

Hi @peterluan -

 

It depends on the website and whether there is an API or direct link to get to the data. If you have specific example/site we could explore options for you.

 

Check out this webinar (with code and slides provided) for general techniques that might help.

 

Chris

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
peterluan
Calcite | Level 5

Thanks for the information. I still need to investigate what you suggested.

 

I have captured the “owssvr.iqy” file ( when you click the ‘export to Excel’) and copy the URL in it.

Then  ran:

 

FILENAME sp_tprm  "C:\Users\u407770\prod\data\sp_tprm.XML";

PROC HTTP   

     URL= 'http://xxxxxx.xxxxx.xxxxx.net/sites/corprisk-opsrisk-038/_vti_bin/owssvr.dll?XMLDATA=1&List={ABF6A9A...'

     OUT=sp_tprm

     AUTH_NTLM

     METHOD="GET";

RUN;

 

“sp_tprm.XML” looks good.

Stokke, Delayne H.<Delayne.Stokke@wellsfargo.com> helped me with reading the xml file using the SAS XML mapper to come up with xml map and xml tables. However, he found transcode errors, and was able to read the whole file using SAS 9.4 (Unicode Support). Everything seems working except two fields still contains HTML/XML tags.

 

Any suggestions?

 

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