Save Data to a SAS Library

If you want to save certain variables in a DataObject to a data set in a SAS library, use the WriteVarsToServerDataSet method of the DataObject.

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

 
   dobj.WriteVarsToServerDataSet( {"Name" "latitude" "longitude"}, 
         "Work", "HurrLatLon", true ); 

The first argument of the WriteVarsToServerDataSet method specifies the name of the variables in the DataObject that you want to write to the server. The next two arguments specify the SAS library (Work) and name of the data set (HurrLatLon) to be written. The last argument is a Java boolean argument. If you specify true, then observations that are marked Exclude from Analysis are not written to the server. If you specify false, then all observations are written to the server.

Note: Java is a case sensitive language, so the last argument of the WriteVarsToServerDataSet method must be lowercase.

If you want to write all variables to a SAS data set on the server, you can use the WriteToServerDataSet method. It is more efficient to write only the variables that are relevant to your analysis. For example, if you intend to run a regression that relates a single response variable to two explanatory variables, you should write only those three variables to the server data set.