DataObject.CreateFromFile

Prototypes

static DataObject CreateFromFile( <String sName,> String sPathName )

Return Value

The return value is a reference to the newly created object of the DataObject class.

Parameters

String sPathName
The filename of, and optionally the path to, the file to use to populate the DataObject. If the filename does not end with an appropriate extension, IMLPlus appends the extension .sas7bdat automatically. See Remarks for more information.

String sName
The name to assign to the DataObject.

Remarks

This method creates an object of the DataObject class and populates it with data from the specified file. If you do not specify the parameter sName, the filename (excluding the extension) is used as the name of the DataObject.

IMLPlus performs the following steps to locate the file specified by the sPathName parameter:

  1. IMLPlus first tries to open the file using the sPathName string literally.
  2. If sPathName is either a filename or a relative pathname and it refers to an IMLPlus Matrix file (.imx extension), IMLPlus searches for the file on the Matrix Search Path.
  3. If sPathName is either a filename or a relative pathname, IMLPlus searches for the file on the Data File Search Path.
  4. If IMLPlus cannot open the file using the previous steps, it reports an error.

You can configure the Matrix Search Path and the Data File Search Path using the Directories tab of the Options dialog box.

This method can read the following types of files:

Filename Extension File Type
.imx IMLPlus Matrix
.jmp JMP Data Table (must be in extended file format)
.sas7bdat SAS Data Set (Version 7 and later)
.sd2 SAS Data Set (Version 6)

For information about how the DataObject class supports SAS data set passwords, refer to Password Support.

Note that the 64-bit edition of IML Studio cannot read or write SAS version 6 data sets.

Example
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "baseball" );
DataTable.Create( dobj ).ActivateWindow();
See Also

DataObject.Create
DataObject.CreateFromExcelFile
DataObject.CreateFromOtherServerDataSet
DataObject.CreateFromServerDataSet