Download a SAS data file from a web server to your local computer
Description
The %net_use macro will download a SAS data file over the internet to your local computer
Syntax
%net_use( url_file [ , data_loc , filename ] )
- The url_file is the web address of the file you want to download, including the name of the file and the extension of the file. This parameter is required.
- The data_loc is the name of a folder on your local machine where you would like the file to be downloaded. This parameter is optional and defaults to the SAS WORK directory.
- The filename is the name you would like for the file on your local machine. This parameter is optional, and the default is that the file will be named the same as it was on the web server.
Examples
To download hsb2.sas7bdat from https://stats.idre.ucla.edu/stat/sas/macros and store it in your work directory, you can type
%net_use(https://stats.idre.ucla.edu/stat/sas/macros/hsb2.sas7bdat)
and then you could list the observations in this file as shown below.
proc print data=hsb2;
run;
To do the same as above, but rename the file to be myfile.sas7bdat, you can type
%net_use(https://stats.idre.ucla.edu/stat/sas/macros/hsb2.sas7bdat, , myfile.sas7bdat)
and then you could list the observations in this file as shown below.
proc print data=myfile;
run;
To do the same as above, but to store the file in c:temp, you can type
%net_use(https://stats.idre.ucla.edu/stat/sas/macros/hsb2.sas7bdat, c:temp , myfile.sas7bdat)
and then you could list the observations in this file as shown below.
proc print data="c:tempmyfile";
run;
Also See
Also see the help for %net_copy and %net_get.