*Syntax;
LIBNAME Rameshlb "C:\Dev\Ramesh";
FILENAME destfile "C:\Dev\home_training\ltest.xpt";
PROC CPORT LIBRARY = Rameshlb FILE = destfile ;
SELECT test/MEMTYPE=data;
RUN;
/*
Explanation:
LIBNAME <name of the library where the dataset is> "<path to that library>";
FILENAME destfile "path and name of the destination file with .xpt extension";
PROC CPORT LIBRARY = <name of the library where the dataset is> FILE = destfile ;
SELECT <name of the dataset that you are exporting>/MEMTYPE=data;
RUN;
*/
The blog entries I am making here are for my quick reference sake only. Anybody is free to view the content but use it at your own risk. As I mentioned earlier it is for my own reference. ThanQ! Thanks to "The Little SAS Book" by Lora D.Delwiche and Susan J.Slaughter. This book is a life saver for SAS programmers.
Saturday, October 1, 2016
Import a non-fda xpt file to sas dataset
* Import a non-fda xpt file to sas dataset;
*syntax;
FILENAME srcfile "C:\Dev\home_training\ntest.xpt";
PROC CIMPORT DATA = rameshlb.ntest INFILE = srcfile;
RUN;
*Explanation;
FILENAME srcfile "<location and name of the xpt file that need to be imported>";
PROC CIMPORT DATA = <name of the library where you want to import>.<would be name of dataset> INFILE = srcfile;
RUN;
*syntax;
FILENAME srcfile "C:\Dev\home_training\ntest.xpt";
PROC CIMPORT DATA = rameshlb.ntest INFILE = srcfile;
RUN;
*Explanation;
FILENAME srcfile "<location and name of the xpt file that need to be imported>";
PROC CIMPORT DATA = <name of the library where you want to import>.<would be name of dataset> INFILE = srcfile;
RUN;
How to access a sas dataset that is available in a folder on local computer?
Say, you have a data-set (abc.sas7bdat) on your local in a folder C:\myfolder.
- Start SAS on your local.
- Create a library -- LIBNAME MYLIB "C:\myfolder";
- The MYLIB library is now available for you, and you can access the dataset from there.
How do you create your own formats?
The FORMAT procedure creates formats that will later be associated with variables in a FORMAT statement.
Example:
PROC FORMAT;
VALUE $GNRF "F"="FEMALE"
"M"="MALE"
;
RUN;
PROC FREQ DATA=araw.demo06q1;
TABLES gndr_cod/MISSING;
FORMAT gndr_cod $gnrf.;
RUN;
Example:
PROC FORMAT;
VALUE $GNRF "F"="FEMALE"
"M"="MALE"
;
RUN;
PROC FREQ DATA=araw.demo06q1;
TABLES gndr_cod/MISSING;
FORMAT gndr_cod $gnrf.;
RUN;
what is PROC UNIVARIATE?
PROC UNIVARIATE produces statistics and graphs describing the distribution of a single variable.
PROC UNIVARIATE;
VAR variable-list;
PROC UNIVARIATE;
VAR variable-list;
What is ODS in SAS?
The Output Delivery System (ODS) is a powerful tool for creating all sorts of output formats.
Subscribe to:
Posts (Atom)