![]() Chapter Contents |
![]() Previous |
![]() Next |
The DATASOURCE Procedure |
proc datasource filetype=dribasic infile=citifile interval=month out=dataset; keep exrjan exrsw exruk; run;
The KEEP statement also allows input names to be quoted strings. If the name of a series in the input file contains blanks or special characters that are not valid SAS name syntax, put the series name in quotes to select it. Another way to allow the use of special characters in your SAS variable names, is to use the SAS options statement to designate VALIDVARNAME= ANY. This option will allow PROC DATASOURCE to include special characters in your SAS variable names. The following is an example of extracting series from a FAME database using the DATASOURCE procedure.
proc datasource filetype=fame dbname='fame_nys /disk1/prc/prc' interval=weekday out=outds outcont=attrds; range '1jan90'd to '1feb90'd; keep cci.close '{ibm.high,ibm.low,ibm.close}' 'mave(ibm.close,30)' 'crosslist({gm,f,c},{volume})' 'cci.close+ibm.close'; rename 'mave(ibm.close,30)' = ibm30day 'cci.close+ibm.close' = cci_ibm; run;
The resulting output data set OUTDS contains the following series: DATE, CCI_CLOS, IBM_HIGH, IBM_LOW, IBM_CLOS, IBM30DAY, GM_VOLUM, F_VOLUME, C_VOLUME, CCI_IBM.
Obviously, to be able to use KEEP and DROP statements, you need to know the name of time series variables available in the data file. The OUTCONT= option gives you this information. More specifically, the OUTCONT= option creates a data set containing descriptive information on the same frequency time series. This descriptive information includes series names, a flag indicating if the series is selected for output, series variable types, lengths, position of series in the OUT= data set, labels, format names, format lengths, format decimals, and a set of FILETYPE= specific descriptor variables. For example, the following statements list some of the monthly series available in the CITIFILE:
filename citifile 'host-specific-file-name' <host-options>; proc datasource filetype=dribasic infile=citifile interval=month outcont=vars; run; title1 'Some Time Series Variables Available in CITIFILE'; proc print data=vars noobs; run;
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.