Method 1.
If you are using SAS version 6.12 in Unix...
Step 1
Output SAS data to the desired directory as usual. The file extension using SAS version 6.12 should be .ssd01. Suppose a SAS data file named myfile.ssd01 is located under /home/user/data/.
Step 2
In Splus 3.4 or above, use the function sas.get(). For example, if you want to name the data set as "mydata" in Splus, type the following at the Splus prompt:
mylibrary <- "/home/user/data/"
mydata <- sas.get(mylibrary,"myfile")
For more detail, do help(sas.get).
OR
In Splus 5 or above, use the function importData(). For example, if you want to name the data set as "mydata" in Splus, type the following at the Splus prompt:
mydata <- importData("/home/user/data/myfile.ssd01",type="SAS1")
For more detail, do help(importData).
If you are using SAS version 7 in Unix...
Step 1
Output SAS data to the desired directory as usual. The file extension using SAS version 7 should be .sas7bdat. Suppose a SAS data file named myfile.sas7bdat is located under /home/user/data/.
Step 2
In Splus 5 or above, use the function importData(). For example, if you want to name the data set as "mydata" in Splus, type the following at the Splus prompt:
mydata <- importData("/home/user/data/myfile.sas7bdat",type="SAS7")
For more detail, do help(importData).
If you are using SAS version 8 in Unix... see Method 2.
Method 2 (recommended). Create a transport file from SAS (this works for SAS version 6.12 or above)
Step 1
In the SAS code, include the following line when defining SAS libraries:
libname sasdata xport "/home/user/data/file.tpt";
- "libname" and "xport" are required in the syntax
- "sasdata" is the user-defined library name
- "/home/user/data/file.tpt" is the full path name of the transport file (Note the .tpt extension!). "file.tpt" is the file you want to output from SAS and later to be read into Splus
Don't forget to name the file to be outputted in a SAS procedure as "sasdata.file.tpt" in the SAS code!
Step 2
In Splus 5 or above, use the function importData(). For example, if you want to name the data set as "mydata" in Splus, type the following at the Splus prompt:
mydata <- importData("/home/user/data/file.tpt",type="SAS_TPT")
For more detail, do help(importData).
Note:
1. Splus 3.4 does not have the importData() function.
2. The sas.get() function may not read data files created by SAS of version 7 or above.
3. The importData() function may not read data files from SAS of version 8 even though the file suffix can be the same as version 7 files (.sas7bdat).
4. For Splus 4+ in Windows, use the import.data() function instead.