DATA Step, Macro, Functions and more

exporting files to local SAS EG

Reply
Contributor
Posts: 32

exporting files to local SAS EG

Hi,

im working in SAS EG and want my programm to export excel files in local, but when i affect path to output statement in the proc export it display the following error:

ERROR: Physical file does not exist, /SAS92/config/Lev1/SASApp/C:\Documents and Settings\louzia\Bureau\12032015 projet TDB prepaid

       mustapha\echantillon_OTHMANE.xls.

This is what my server looks like:

Serveur

   user_folder

   sasuser

      personne1

     personne2

     .

     .

     .

     personne10 (Me)

          files

               excelfiles

                      myfile.xls

Super User
Posts: 7,757

Re: exporting files to local SAS EG

Your SAS (behind EG) is not local, it is installed on a remote UNIX server. Either use the EG export wizard (which can write to your local disk), or write the file to your UNIX home directory and copy it from there to your local disk (eg with WinSCP).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 32

Re: exporting files to local SAS EG

Posted in reply to KurtBremser

Thank you, but how can i write the file to my UNIX home directory?

Super User
Posts: 7,757

Re: exporting files to local SAS EG

Knew that one was coming Smiley Wink

Some things about the UNIX filesystem:

The character separating directories is the forward slash, not the backward slash as in Windows

(Usage of the backslash in Windows comes from the fact that its ancestor CP/M had no directory hierarchy, but used the forward slash for commandline parameters; when Gates&Allen grafted the hierarchical filesystem to DOS 2, they used the backslash, instead of making DOS compatible with existing systems that had a hierarchical FS)

There are no drive designators, all file resources are "mounted" into a single tree

The tree starts with root (/); everything else is in subdirectories

A path starting with / originates from root and is called an absolute path; a path not starting with a / is called relative and denotes a path starting in the current working directory of the process. This is the reason why you see your "C:\Documents and Settings\...." appended to the working directory of the SAS workspace server.

As a big help, an environment variable ($HOME) is provided which contains the absolute path to your home directory.

So, to create a file in your home directory, use (as an example)

data _null_;

set something;

file "$HOME/file.csv" file_options;

put ......;

run;

You will then find this file in the Files section of your SASApp server in the server list in EG (you may have to refresh). Some file types can be transferred in EG by adding to the project and then exporting to the local disk.

My preferred method is to use WinSCP to do file transfers, as I can transfer anything and have total control over the process.

Edit: directories instead of characters (see bold print)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 32

Re: exporting files to local SAS EG

Posted in reply to KurtBremser

Thnks, i fond it

Valued Guide
Posts: 860

Re: exporting files to local SAS EG

Fadel, Please mark the question as answered.  It helps the community run smoother.

Thanks,

Ask a Question
Discussion stats
  • 5 replies
  • 932 views
  • 6 likes
  • 3 in conversation