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. 

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 0 replies
  • 861 views
  • 0 likes
  • 1 in conversation