I have this routine whereby I need to analyze data from the server.
However, I find that doing the analysis locally is much more pleasant than using the server.
What's the best way to download the a sas data to a local folder?
*connection to server; rsubmit; proc sql; create table tolocal as select * from servertable where <conditions> ;quit; endrsubmit; * tolocal is now in Rwork; *define local folder on desktop; libname mylocal "C:\Users\Working folder"; *download data to mylocal; data mylocal.tolocal; set rwork.tolocal;run;
Is it possible to do everything within rsubmit?
It seems that I can't define the local folder within rsubmit..
Since you have both PC SAS and server SAS you could download your SAS data using PROC DOWNLOAD which has the smarts to know about your local LIBNAMEs:
rsubmit;
proc download data = tolocal
out = mylocal.tolocal;
run;
endrsubmit;
It depends. Sometimes the desktop and server have different modules licensed. For example we had SAS IML on desktops but not server... not sure why. Most things should be able to run on the server and should be faster since they're typically much faster machines. Sometimes network speed can mess that up though. It does require a small shift in how you work but once you figure it out it's significantly faster.
No you can't define a local folder on the server, you need to give it a location the server has access to, somewhere on the server or a shared drive.
Yes, because data steps read each line and proc download or even proc copy can move the data in blocks.
A datastep could create new variables or change the dataset somehow. If none of this is occurring a different method is more efficient.
Since you have both PC SAS and server SAS you could download your SAS data using PROC DOWNLOAD which has the smarts to know about your local LIBNAMEs:
rsubmit;
proc download data = tolocal
out = mylocal.tolocal;
run;
endrsubmit;
Hi,
on SAS/CONNECT non licensed Windows machines, one could use robocopy to perform the task.
Robocopy has the big advantage that it creates the output folder by its own and can also copy subdirectory files without further specifying them.
Consult robocopy /? in the command line for more details.
libname inLib "C:\TEMP\input Lib Folder"; libname outLib "C:\TEMP\output Lib Folder"; x "robocopy ""%sysfunc(pathname(inLib))"" ""%sysfunc(pathname(outLib))"" *.sas7bdat *.png /MIR"; /* interesting parameters: /PURGE /XF /XD /LOG: */
I would advise to use the compress option on SAS datasets whenever possible if you intend to regularly transfer a big amount of files over your network.
- Cheers -
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: