BookmarkSubscribeRSS Feed
saswiki
Obsidian | Level 7

Hi Experts, 

 

I am stuck with the logic where i need to automate reading the txt files from sharepoint. The requirement is to pull all the txt files which are available in the Sharepoint folder. I am able to copy and read the files one by one but i need to automate this process. Your idea/suggestions would really help me. 

 

Here is the code for reading one file : 

 

filename outfile "/sasdata/MCS_Change_Notice.txt";

 

PROC HTTP
URL="https://xxxx.sharepoint.com/teams/xxxx/_api/Web/getfilebyserverrelativeurl('/teams/xxxx/Shared%20Doc..."
METHOD="GET" OUT=OUTFILE;
HEADERS
"Authorization"="Bearer &access_token."
"X-RequestDigest"="form digest value"
;
RUN;

 

DATA _Read;
infile "/sasdata/MCS_Change_Notice.txt" truncover delimiter='^' dsd ;
input stuff $5000.;
run;

 

Do we have any method to pull the complete files under sharepoint folder?

 

Let me know if any additional details required. 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 194 views
  • 0 likes
  • 1 in conversation