Chapter Contents |
Previous |
Next |
The DATASOURCE Procedure |
Sometimes the time series variable names as given by data vendors are not descriptive enough, or you may prefer a different naming convention. In such cases, you can use the RENAME statement to assign more meaningful names to time series variables. You can also use LABEL statements to associate descriptive labels with your series variables.
For example, the series names for effective exchange rate (F_X_AM) and exchange rate index (F_X_AH) used by IMF can be given more descriptive names and labels by the following statements:
filename ifsfile 'host-specific-file-name' <host-options>; proc datasource filetype=imfifsp infile=ifsfile interval=month out=exchange outcont=exchvars; where country in ('112','146','158') and partner=' '; keep f_x_ah f_x_am; range from '01jun87'd to '01feb88'd; rename f_x_ah=exrindex f_x_am=effexr; label f_x_ah='F_X_AH: Exchange Rate Index 1985=100' f_x_am='F_X_AM: Effective Exchange Rate(MERM)'; run; title1 'Printout of OUTCONT= Showing New NAMEs and LABELs'; proc print data=exchvars noobs; var name label length; run; title1 'Contents of OUT= Showing New NAMEs and LABELs'; proc contents data=exchange; run;
The RENAME statement 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, use the SAS option VALIDVARNAME= ANY or put the series name in quotes to rename it. See the FAME example using rename in the "Selecting Time Series Variables -- The KEEP and DROP Statements" section.
|
Notice that even though you changed the names of F_X_AH and F_X_AM to EXRINDEX and EFFEXR, respectively, you still used their old names in the KEEP and LABEL statements because renaming takes place at the output stage.
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.