Save Data to the Client

If you want to save data in a DataObject to a SAS data set on your PC, use the WriteToFile method.

Add the following statement at the bottom of the program window, and select ProgramRun from the main menu.

 
   dobj.WriteToFile("C:\MyHurricanes.sas7bdat"); 

You must append the sas7bdat file extension to the filename when you use the WriteToFile method. If you omit the extension, you get an error message that notifies you that the file format is not supported.

It is often convenient to save data to your personal files directory, as described in the section Open a Client Data Set. You can get the Windows path for your personal files directory by using the GetPersonalFilesDirectory module. The following statements save data to the Data Sets folder under your personal files directory:

 
   run GetPersonalFilesDirectory( path ); 
   fname = path + "Data Sets\MyHurricanes.sas7bdat"; /* concatenate strings */ 
   dobj.WriteToFile( fname );