Resources

Rename Using N-literals-Writing Time Series to the SAS Data Set

/*----------------------------------------------------------------

                   SAS Sample Library

        Name: famex03b.sas
 Description: Example program from SAS/ETS User's Guide,
              The SASEFAME Interface Engine
   Title: Rename Using N-literals-Writing Time Series to the SAS Data Set
 Product: SAS/ETS Software
    Keys: FAME data extraction
   Procs: SASEFAME
   Notes: Read this before you run this sample.
        The database resides in the ets/sasmisc folder. You
        must copy the database to a writeable folder before
        using it. Then define your Windows system environment
        variable, FAME_DATA, to the path of your
        writeable folder containing
        the oecd1.db file (FAME database).
        To assign a fileref to the external file to be processed,
        use the following form of the libname statement:

libname famedir sasefame "%sysget(FAME_DATA)"
        convert=(freq=annual technique=constant);
----------------------------------------------------------------*/

options validvarname=any;

%let FAME=%sysget(FAME);
%put(&FAME);
%let FAMETEMP=%sysget(FAME_TEMP);
%put(&FAMETEMP);

libname famedir sasefame "%sysget(FAME_DATA)"
        convert=(freq=annual technique=constant);

libname mydir "%sysget(FAME_TEMP)";

data mydir.a;  /* add data set to mydir */
   set famedir.oecd1;
   /* keep and rename  */
   keep date 'ita.dirdes'n--'jpn.herd'n 'tur.dirdes'n--'usa.herd'n;
   rename 'ita.dirdes'n='italy.dirdes'n
          'jpn.dirdes'n='japan.dirdes'n
          'tur.dirdes'n='turkey.dirdes'n
          'usa.dirdes'n='united.states.of.america.dirdes'n ;
run;

title1 "OECD1: TECH=Constant, FREQ=Annual";
title2 "keep statement using n-literals";
title3 "rename statement using n-literals";

proc print data=mydir.a;
run;