SAS Notes
Compiled by : Wilson Suraweera @ CGHR
- Contents
- Random Numbers in SAS
- Data Sub-setting
- Selection of two Random Samples
- Identification
and Separation of duplicate records in SAS dataset
-
Reshape Long list variable dataset to
Wide list dataset
- Missing values replacement with Means of the
respective Variables
- Logistic Regression with SAS
- SAS made
easy using Proc SQL
- SAS PROC SQL procedure to access external ODBC
data sources
- SAS String Data Handling
- SAS Missing value arithmetic's
-
Update_a_Table_using_Another_Table_in_SAS
-
Text analysis - an Epidemiological Case Study by WS - SAS Institute HUG -01 April2011
-
- External Resources
-
SAS Knowledge Base - Glossary of SAS Procedures from SAS.com
-
SAS resources from
- UCLA
- Logistic regression
-
Survival Analysis : Usage of Proc LifeTest and Proc PHREG
- SAS Dinosaur - Old and New way
of SAS programming
- Paul Dicman's Web Page for SAS- This little old discusses SAS 8, but useful
- Global Statements Dictionary -
Alphabetical listing and Description of SAS Key words
- SAS Study Blog
- SAS Canada - User Groups
-
Reading and Writing XPORT transport files in SAS 9
Q. What is the XPORT transport format, generally ?
A. Transport files that are created by the XPORT engine can be transferred across operating environments and read using the
XPORT engine with the DATA step or PROC COPY. For example a dataset created in SAS 9 can be read in SAS 8 or vice versa.
Here is the process for creating a transport file at the source computer and reading it on a target computer:
1. A transport file is created at the source computer using the XPORT engine with the DATA step or PROC COPY.
2. The transport file is read at the target computer using the XPORT engine with the DATA step or PROC COPY.
There are some limitations in data transfer. Please refer SAS manual (pp 31-pp 36) for further details
(http://support.sas.com/documentation/cdl/en/movefile/67439/PDF/default/movefile.pdf)
XPORT transport Generation SAS 9
(a) Example of creation of Xport file in SAS 9.4:
We select Xport-in library as the ‘SAShelp’ library in SAS 9 and ‘Class’ dataset in it as the input dataset.
libname xportout Xport 'C:\Wilson\help’; /* Xport-out Lib name */
/* (a.1) Using Data step */
data xportout.Class;
set SAShelp.Class;
run;
/* (a.2) Using Proc Copy */
proc copy in=SAShelp out=xportout memtype=data;
select Class; /* if select statement was omitted, whole library will be copied*/
run;
CAUTION: Do not omit the MEMTYPE=DATA option. Otherwise, SAS attempts to copy the entire contents of the
library (including catalogs and views) to the transport file. The XPORT engine does not support
the CATALOG or the VIEW member type. Error and warning messages are written to the SAS log.
Reading Xport files in SAS 9
(b) Example of Reading Xport files in SAS 9
Suppose file path of my XPORT transport file name 'xpt_infile.xpt' is 'C:\Wilson'
and target SAS dataset should be in the 'C:\Wilson\data', then SAS code will be
libname target 'C:\Wilson’;
/* (b.1) Using Data step */
data target .Class_new;
set xportout.Class; /* Previously xport out library is xport in library here */
run;
/* (b.2) Using Proc Copy */
proc copy in=xportout out=srs memtype=data;
select Class; /* if select statement was omitted, whole library will be copied*/
run;
Note: You can use the EXCLUDE statement in PROC COPY to omit explicitly the data
sets that you do not want instead of using the SELECT statement to specify the data
sets that you want.