BookmarkSubscribeRSS Feed
sasstar
Calcite | Level 5

Hi I am trying to export sas eg result into an excel on a shared drive in a windows environment.

I am trying to use the x "scp....

The code runs and no error or warning messages exist in the log however the file transfer is not taking place.

Can anyone suggest why this might be happening or any similar experience in the past.

Thanks

5 REPLIES 5
LinusH
Tourmaline | Level 20

The X statement does not echo back your OS commands.  You can use filename pipe instead.  Or do a remote desktop connection to your windows server with the same account and try your scp instruction there.

Data never sleeps
sasstar
Calcite | Level 5

Thanks for the note what is filename pipe. Can you please provide an example.

SASKiwi
PROC Star

What operating system does your SAS server use? How are you creating your Excel file in the first place - in a SAS program / process flow or from an EG menu?

Please clarify so we can help you better.

sasstar
Calcite | Level 5

Thank you for the note.

I am currently writing my code in SAS-EG which is being operated on a Unix environment.

Once the final dataset is created I would like to export that dataset and create an excel spreadsheet onto a shared drive (Which is in windows environment).

Currently here is the winscp I am running.

X "scp /opt/sasusershome/myid/LPK_CCA_COMPARE_28JAN2015.xml myid@cirnasnap1n1.corp.samplebank.com/LTBshare$/private/STRATEGIC SERVICES/StratS AWS/CCA_LPK_Compare/te...";

The log is running and not generating any error messages but no file is being written.

Can you please help troubleshoot and let me know if there is any error in my syntax or any other reasons as to why it not happening.

Thank you.


Kurt_Bremser
Super User

To fetch the output of an external command to the SAS log, use the following method:

filename oscmd pipe "your command 2>&1"; * 2>&1 redirects stderr to stdout, so no messages are lost;

data _null_;

infile oscmd;

input;

put _infile_;

run;

Usually the target for scp looks like userid@hostname:path_to_target_file. Note the colon.

I also see a blank in your target path name. I'd rather avoid directory names with blanks, as they force you to use additional (single) quotes.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 5 replies
  • 2521 views
  • 0 likes
  • 4 in conversation