I have seen reference to using a zip file to download but not enough detail was included. Do I want to open up the interface or server? It opens to the same thing?
Any suggestions or other ideas? Thank you.
MM
Use MEMVAR= option, not MEMBER= option.
If that doesn't work then try using DOPEN() DNUM(), DREAD() to get the list of files instead.
filename indir '/home/u.../sasmacs2';
filename out zip '/home/u.../sasmacs2.zip';
data _null_;
length fname mname $256 ;
did=dopen('indir');
putlog did=;
do i=1 to dnum(did) ;
mname=dread(did,i);
if scan(mname,-1,'.')='sas' then do;
n+1;
putlog n= mname= ;
fname=catx('/',pathname('indir'),mname);
infile dummy filevar=fname end=eof;
file out memvar=mname;
do while (not eof);
input ;
put _infile_;
end;
end;
end;
did=dclose(did);
run;
Are you using SAS studio to access SAS or Viya? Viya does not appear to really have a file system so it will probably be harder to use a non-SAS tool to move files.
It is probably easier to upload/download a lot of files using a different user interface than SAS/Studio.
Do you have access to a file system that the server(s) that SAS/Studio is using to run SAS code lives on? Perhaps you could even connect your personal computer to one of the file systems that the SAS server is using and just use your native file copy methods. Otherwise you could use an interactive tool (like the FILEZILLA that you appear to be asking about). Essentially you just need to know what is the path that the files have on the server where SAS is running and move the files from there.
If you are forced to use SAS/Studio itself to move the files then it might help to create a ZIP file first and then you only need to copy the one file. You you might be able to use SAS code to create a ZIP file. For example if you had a lot of text files on your SAS server in a particular folder you could make a SAS file that contains those files with a data step like this:
filename in 'path to files';
filename out zip 'filename of new zip file';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out member=mname ;
put _infile_;
run;
@MaryA_Marion wrote:
I installed fileZilla but do not know how to complete the connection to sas studio in sas on demand. Please see enclosed file. Thank you. MM
I was talking about connecting to some server in your company that you were using to run SAS.
Are you sure that SAS will allow you to connect to the server where SAS runs for SAS Studio on Demand without using SAS/Studio? I would be surprised if they did that.
how to download a directory of sas files to pc using sas studio (sas on demand)
Filezilla requires an FTP server. Unless one has been installed, you can't use that.
A browser client needs to connect to a web server, just like an FTP client like Filezilla needs to connect to an FTP server.
Your IT team typically manages such servers.
The directory of sas files I want to download is sasmacs2 in my home directory. I am getting error messages when using your code. It asks me for fname and mname. I am not certain what to enter in there?
MM
> It asks me for fname and mname.
What does ask mean?
fname and mname are populated automatically when you run the program.
Show use what you are doing.
filename in '/home/u.../sasmacs2'; filename out zip 'sasmacs2'; data _null_; length fname mname $256 ; infile in('*') filename=fname ; input; mname = scan(fname,-1,'/\'); file out member=mname; put _infile_; run;
Please see log below. I am trying to keep my u number private so you will see ... on the page. I ran the source code while in sasmacs2 directory and while in the home directory with same results.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /home/u.../.sasstudio/.images/fefa4007-e77f-4646-84e3-e47c3f4b 23b8 SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL GSFNAME=_GSFNAME; 68 69 70 71 72 73filename in '/home/u.../sasmacs2'; filename out zip 'sasmacs2';data _null_; 74length fname mname $256 ; 75infile in('*') filename=fname ; 76input; 77mname = scan(fname,-1,'/\'); 78file out member=mname; 79put _infile_; 80run; NOTE: The infile library IN is: Directory=/home/u.../sasmacs2, Owner Name=u...,Group Name=oda, Access Permission=drwxr-xr-x,Last Modified=16Aug2021:22:42:00 NOTE: The infile IN('*') is: Filename=/home/u.../sasmacs2/DevianceTable.sas, File List=/home/u.../sasmacs2/*,Owner Name=u...,Group Name=oda,Access Permission=-rw-r--r--,Last Modified=25Jul2021:13:06:47,File Size (bytes)=410 ERROR: Insufficient authorization to access sasmacs2. NOTE: A total of 0 records were read from the infile library IN. NOTE: 0 records were read from the infile IN('*'). NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time0.05 seconds user cpu time0.01 seconds system cpu time 0.02 seconds memory578.59k OS Memory24224.00k Timestamp08/17/2021 01:51:55 PM Step Count39 Switch Count 0 Page Faults0 Page Reclaims90 Page Swaps0 Voluntary Context Switches255 Involuntary Context Switches 0 Block Input Operations8 Block Output Operations8 81 82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; SYMBOLGEN: Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE; 92
As I understand it you are using SAS on Demand which operates in a locked down state with limited user permissions. So the errors you are getting are not surprising. You would be best to talk with SAS Tech Support to find out what you can and can't do in SAS on Demand.
filename out zip 'sasmacs2';
Try providing the full path, to a folder where you can write.
Thanks to all of you for your help. I've got the following response from SAS. "Since SAS OnDemand for Academics is a free learning software it does have some limitations as to it's capabilities and unfortunately, SAS OnDemand for Academics is not able to be used with FTP."
I have gotten SAS code to create a zip file. However, it is not opening properly using WinZip on my PC. I'm enclosing the code for you to see as well as the error message on my PC. There are no errors in the log. Zip file was downloaded using the download icon in SAS Studio.
SOURCE
filename in '/home/u.../sasmacs2';
filename out zip '/home/u.../sasmacs2.zip';
data _null_;
length fname mname $256 ;
infile in('*') filename=fname ;
input;
mname = scan(fname,-1,'/\');
file out member=mname;
put _infile_;
run;
Log:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /home/u.../.sasstudio/.images/be90d0a4-57bd-49ef-8e8f-e451f5e9 6f06 SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL 78GSFNAME=_GSFNAME;filename in '/home/u.../sasmacs2'; filename out zip '/home/u.../sasmacs2.zip'; data _null_;length fname mname $256 ;infile in('*') filename=fname ;input;mname = scan(fname,-1,'/\');file out member=mname;put _infile_;run; NOTE: The infile library IN is: Directory=/home/u.../sasmacs2, Owner Name=u...,Group Name=oda, Access Permission=drwxr-xr-x,Last Modified=17Aug2021:15:21:32 NOTE: The infile IN('*') is: Filename=/home/u.../sasmacs2/DevianceTable.sas, File List=/home/u.../sasmacs2/*,Owner Name=u...,Group Name=oda,Access Permission=-rw-r--r--,Last Modified=25Jul2021:13:06:47,File Size (bytes)=410 NOTE: The file OUT is:Filename=/home/u...sasmacs2.zip NOTE: The infile IN('*') is: Filename= ...
NOTE: 72 records were read from the infile IN('*').
The minimum record length was 0.
The maximum record length was 83.
NOTE: 8430 records were written to the file OUT.
The minimum record length was 0.
The maximum record length was 32767.
NOTE: DATA statement used (Total process time):
real time 0.17 seconds
user cpu time 0.01 seconds
system cpu time 0.04 seconds
memory 1083.37k
OS Memory 20640.00k
Timestamp 08/19/2021 02:37:22 PM
Step Count 53 Switch Count 0
Page Faults 0
Page Reclaims 249
Page Swaps 0
Voluntary Context Switches 333
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 96
81 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE;
MM
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.