BookmarkSubscribeRSS Feed
smilingmelbourne
Fluorite | Level 6
Hi, I ran this code to remotely connect to a server in order to download data and zip it before downloading it to a local PC using SSH File Transfer, but it doesn't give me what I wanted.

%let....
options comamid=....
signon username=_prompt_;
rsubmit;

data _null_;
call system('mkdir /temp/myname);
run;

libname mydata '/temp/myname';

data mydata.something; /*collect data & put it in my directory created above*/
set datasource;
/*codes here*/
run;

/*Things go wrong here*/
data _null_; /*compress data just collected and put it in same directory*/
call system('gzip /temp/myname/something');
run;

After logging in SSH and checking the directory "myname", I saw the file "something" BUT IT IS NOT ZIPPED! The GZIP command wasn't executed in the last SAS codes above. Why so?

Can anyone please help? Thanks a lot
3 REPLIES 3
Patrick
Opal | Level 21
Hi
If the code you've posted is 1:1 the code you've run with issues then one of the reasons might be that there is a quote missing.

call system('mkdir /temp/myname); ... there should be a quote after .../myname


What I normally do with OS commands: I first try them in a command prompt before I use them in SAS. In your example you could issue the gzip command first in a putty session and see if it works from there.

Else: What does the SAS log tell you?

HTH
Patrick
smilingmelbourne
Fluorite | Level 6
Hi Pattrick, I missed the quote in the codes posted here, but in the original SAS program I have both quotes in the argument to the Call System function.

I've tried the GZIP command in both SSH Secure Shell Client and Putty and it works perfectly. The file is zipped.

The SAS log doesn't say anything about errors. Right below the codes that has the Call System, I saw a few lines like:

"Data statement used (Total process time):
real time 0.17 seconds
cpu time 0.01 seconds"

However, when I logged in SSH I saw data set but it wasn't compressed, meaning the GZIP function wasn't executed.

Thanks a lot for help

Message was edited by: smilingmelbourne Message was edited by: smilingmelbourne
smilingmelbourne
Fluorite | Level 6
I missed the file extension for the SAS dataset, so I didn't work. It should have been........

data _null_;
call system('gzip /temp/myname/something.sas7bdat'); /*Add file extension "sas7bdat and it works"*/
run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1407 views
  • 0 likes
  • 2 in conversation