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

Hello Experts,

 

You know that in web, there is the request (the client's request -> server) and the response (server -> client's browser). The response from http://XXXXXX is a file stream type txt (generated with php).

 

So physical file doesn't exist, while clicking on  http://XXXXXX

 

I'm wondering if there is possible to import this kind of file ? 

 

Thank you for helping !

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12

If you use SAS 9.4(M3 and later), you can use proc http.

Try this code.

 

filename webdoc 'c:/temp/want.txt' encoding='utf-8';  
proc http  
 method="get"  
 url="https://www.google.com/"  
 out=webdoc;  
run;  
  
data test;  
 infile webdoc;  
 attrib buf length=$4096;  
 input buf $4096.;  
 put buf=;  
run;  

 

you can get 'c:/temp/want.txt' as a text file, and 'WORK.TEST' as a dataset.

 

View solution in original post

2 REPLIES 2
japelin
Rhodochrosite | Level 12

If you use SAS 9.4(M3 and later), you can use proc http.

Try this code.

 

filename webdoc 'c:/temp/want.txt' encoding='utf-8';  
proc http  
 method="get"  
 url="https://www.google.com/"  
 out=webdoc;  
run;  
  
data test;  
 infile webdoc;  
 attrib buf length=$4096;  
 input buf $4096.;  
 put buf=;  
run;  

 

you can get 'c:/temp/want.txt' as a text file, and 'WORK.TEST' as a dataset.

 

SASdevAnneMarie
Barite | Level 11
Thank you, Kawakami !
That works !

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 2 replies
  • 988 views
  • 1 like
  • 2 in conversation