Previous Page | Next Page

The SASEFAME Interface Engine

Example 34.11 Selecting Series Using FAMEOUT= Option

This example shows how to read case series instead of time series. Case series can be numeric, boolean, string, date, or formulas that resolve to series. SASEFAME resolves all formulas that belong to the type of series data object that you specify in your FAMEOUT= option. If these object types are not specified, the FAMEOUT= option defaults to time series.

The first case shows writing of all boolean case series to your SAS data set, while the second shows selection of numeric case series; the third shows writing all date case series to your SAS data set, while the fourth shows selection of all the string case series. The last case shows output of the SOURCE for all the formula case series in the ALLTYPES data base.

In the first example, suppose you prefer to extract all boolean case series from your FAME data base. The following statements write all boolean case series to your SAS data set. The results are shown in Output 34.11.1 and Output 34.11.2.

   title1 '***famallt: FAMEOUT option, Different Type Values***';
   options validvarname=any;
   
   %let FAME=%sysget(FAME);
   %put(&FAME);
   %let FAMETEMP=%sysget(FAME_TEMP);
   %put(&FAMETEMP);
   
   libname lib4 sasefame "%sysget(FAME_DATA)"
      fameout=boolcase wildcard="?" ;
   
   data booout;
      set lib4.alltypes;
   run;
   
   title2 'Contents of OUT=booout';
   title3 'Using FAMEOUT=CASE BOOLEAN option without range';
   proc contents 
      data=booout;
   run;
   
   title2 'ALLTYPES FAMEOUT=BOOLCASE and open wildcard for BOOLEAN CASE Series';
   title3 'OUT=BOOOUT from the PRINT Procedure';
   proc print 
      data=booout;
   run;

Output 34.11.1 Contents of OUT=BOOUT Using FAMEOUT=BOOLCASE and Open Wildcard for Boolean Case Series
***famallt: FAMEOUT option, Different Type Values***
Contents of OUT=booout
Using FAMEOUT=CASE BOOLEAN option without range

The CONTENTS Procedure

Alphabetic List of Variables and Attributes
# Variable Type Len
1 BOO0 Num 8
2 BOO1 Num 8
3 BOO2 Num 8
4 BOOM Num 8
5 BOO_RES Num 8

Output 34.11.2 Listing of OUT=BOOOUT Using FAMEOUT=BOOLCASE and Open Wildcard for Boolean Case Series
***famallt: FAMEOUT option, Different Type Values***
ALLTYPES FAMEOUT=BOOLCASE and open wildcard for BOOLEAN CASE Series
OUT=BOOOUT from the PRINT Procedure

Obs BOO0 BOO1 BOO2 BOOM BOO_RES
1 0 1 0 1 .
2 0 0 1 0 .
3 0 0 0 251 .
4 0 1 1 1 .
5 0 1 0 1 .
6 0 0 . 0 .
7 0 0 . 0 .
8 0 1 . 1 .
9 0 . 0 . .
10 0 . . . .
11 1 . . . .
12 1 . . . .
13 1 . 1 . .
14 1 . . . .
15 1 . . . .
16 1 . . . .
17 1 . 0 . .
18 1 . . . .
19 1 . . . .
20 1 . . . .

Suppose instead of boolean case series, you prefer to see numeric case series. Case series can be numeric or boolean or string series or date series. In addition to the existing case series in your FAME database, you can have formulas that resolve to numeric case series. SASEFAME will resolve all formulas that belong to the class and type of series data object that you specify in your FAMEOUT= option. The following statements write all numeric case series to your SAS data set. The results are shown in Output 34.11.3 and Output 34.11.4.

   libname lib5 sasefame "%sysget(FAME_DATA)"
      fameout=case wildcard="?" ;
   
   data csout;
      set lib5.alltypes;
   run;
   
   title2 'Contents of OUT=csout';
   title3 'Using FAMEOUT=CASE option without range';
   proc contents 
      data=csout;
   run;
   
   title2 'ALLTYPES, FAMEOUT=CASE and open wildcard for Numeric Case Series';
   title3 'OUT=CSOUT from the PRINT Procedure';
   proc print 
      data=csout;
   run;

Output 34.11.3 Contents of OUT=CSOUT Using FAMEOUT=CASE and Open Wildcard for Numeric Case Series
***famallt: FAMEOUT option, Different Type Values***
Contents of OUT=csout
Using FAMEOUT=CASE option without range

The CONTENTS Procedure

Alphabetic List of Variables and Attributes
# Variable Type Len
1 FRM1 Num 8
2 NUM0 Num 8
3 NUM1 Num 8
4 NUM2 Num 8
5 NUMM Num 8
6 NUM_RES Num 8
7 PRC0 Num 8
8 PRC1 Num 8
9 PRC2 Num 8
10 PRCM Num 8
11 PRC_RES Num 8

Output 34.11.4 Listing of OUT=CSOUT Using FAMEOUT=CASE and Open Wildcard for Numeric Case Series
***famallt: FAMEOUT option, Different Type Values***
ALLTYPES, FAMEOUT=CASE and open wildcard for Numeric Case Series
OUT=CSOUT from the PRINT Procedure

Obs FRM1 NUM0 NUM1 NUM2 NUMM NUM_RES PRC0 PRC1 PRC2 PRCM PRC_RES
1 0.00000 -9 0 1.33333 0 . -18 0 1.33333 0 .
2 1.00000 -8 1 1.00000 1 . -16 1 1.00000 1 .
3 0.66667 -7 2 0.66667 1.7014E38 . -14 2 0.66667 1.7014E38 .
4 3.00000 -6 3 0.33333 3 . -12 3 0.33333 3 .
5 4.00000 -5 4 0.00000 4 . -10 4 0.00000 4 .
6 . -4 5 . 5 . -8 5 . 5 .
7 . -3 6 . 6 . -6 6 . 6 .
8 7.00000 -2 7 . 7 . -4 7 . 7 .
9 . -1 . -1.33333 . . -2 . -1.33333 . .
10 . 0 . . . . 0 . . . .
11 . 1 . . . . 2 . . . .
12 . 2 . . . . 4 . . . .
13 . 3 . -2.66667 . . 6 . -2.66667 . .
14 . 4 . . . . 8 . . . .
15 . 5 . . . . 10 . . . .
16 . 6 . . . . 12 . . . .
17 . 7 . -4.00000 . . 14 . -4.00000 . .
18 . 8 . . . . 16 . . . .
19 . 9 . . . . 18 . . . .
20 . 10 . . . . 20 . . . .

Instead of numeric case series, you could decide to extract date case series. Case series can be numeric or boolean or string series or date series. In addition to the existing case series in your FAME database, you can have formulas that resolve to date case series. SASEFAME will resolve all formulas that belong to the class and type of series data object that you specify in your FAMEOUT= option. The following statements write all date case series to your SAS data set. The results are shown in Output 34.11.5 and Output 34.11.6.

   libname lib6 sasefame "%sysget(FAME_DATA)"
      fameout=datecase wildcard="?" ;
   
   data cdout;
      set lib6.alltypes;
   run;
   
   title2 'Contents of OUT=cdout';
   title3 'Using FAMEOUT=DATECASE option without range';
   proc contents 
      data=cdout;
   run;
   
   title2 'ALLTYPES, FAMEOUT=DATECASE and open wildcard for Date Case Series';
   title3 'OUT=CDOUT from the PRINT Procedure';
   proc print 
      data=cdout;
   run;

Output 34.11.5 Contents of OUT=CDOUT Using FAMEOUT=DATECASE
***famallt: FAMEOUT option, Different Type Values***
Contents of OUT=cdout
Using FAMEOUT=DATECASE option without range

The CONTENTS Procedure

Alphabetic List of Variables and Attributes
# Variable Type Len Format Informat
1 DAT0 Num 8 YEAR4. 4.
2 DAT1 Num 8 YEAR4. 4.
3 DAT2 Num 8 YEAR4. 4.
4 DATM Num 8 YEAR4. 4.
5 DAT_RES Num 8 YEAR4. 4.
6 FRM2 Num 8 YEAR4. 4.

Output 34.11.6 Listing of OUT=CDOUT Using FAMEOUT=DATECASE
***famallt: FAMEOUT option, Different Type Values***
ALLTYPES, FAMEOUT=DATECASE and open wildcard for Date Case Series
OUT=CDOUT from the PRINT Procedure

Obs DAT0 DAT1 DAT2 DATM DAT_RES FRM2
1 1991 1981 1987 1981 . 1987
2 1992 1982 1986 1982 . 1986
3 1993 1983 1985 1983 . 1985
4 1994 1984 1984 1984 . 1984
5 1995 1985 1983 1985 . 1983
6 1996 1986 . 1986 . .
7 1997 1987 . 1987 . .
8 1998 1988 . 1988 . .
9 1999 . 1979 . . 1979
10 2000 . . . . .
11 2001 . . . . .
12 2002 . . . . .
13 2003 . 1975 . . .
14 2004 . . . . .
15 2005 . . . . .
16 2006 . . . . .
17 2007 . 1971 . . .
18 2008 . . . . .
19 2009 . . . . .
20 2010 . . . . .

The next example shows how to extract string case series. Case series can be numeric or boolean or string series or date series. In addition to the existing string case series in your FAME database, you can have formulas that resolve to string case series. SASEFAME will resolve all formulas that belong to the class and type of series data object that you specify in your FAMEOUT= option. The following statements write all string case series to your SAS data set. The results are shown in Output 34.11.7 and Output 34.11.8.

   libname lib7 sasefame "%sysget(FAME_DATA)"
      fameout=stringcase wildcard="?" ;
   
   data cstrout;
      set lib7.alltypes;
   run;
   
   title2 'Contents of OUT=cstrout';
   title3 'Using FAMEOUT=STRINGCASE option without range';
   proc contents 
      data=cstrout;
   run;
   
   title2 'ALLTYPES, FAMEOUT=STRINGCASE and open wildcard for STRING CASE Series';
   title3 'OUT=CSTROUT from the PRINT Procedure';
   proc print 
      data=cstrout;
   run;

Output 34.11.7 Contents of OUT=CSTROUT Using FAMEOUT=STRINGCASE and Open Wildcard for String Case Series
***famallt: FAMEOUT option, Different Type Values***
Contents of OUT=cstrout
Using FAMEOUT=STRINGCASE option without range

The CONTENTS Procedure

Alphabetic List of Variables and Attributes
# Variable Type Len
1 STR0 Char 16
2 STR1 Char 16
3 STR2 Char 16
4 STRM Char 16

Output 34.11.8 Listing of OUT=CSTROUT Using FAMEOUT=STRINGCASE and Open Wildcard for String Case Series
***famallt: FAMEOUT option, Different Type Values***
ALLTYPES, FAMEOUT=STRINGCASE and open wildcard for STRING CASE Series
OUT=CSTROUT from the PRINT Procedure

Obs STR0 STR1 STR2 STRM
1 -9 0 1.333333 0
2 -8 1 1 1
3 -7 2 0.6666667 2
4 -6 3 0.3333333 3
5 -5 4 0 4
6 -4 5   5
7 -3 6    
8 -2 7   7
9 -1   -1.333333  
10 0      
11 1      
12 2      
13 3   -2.666667  
14 4      
15 5      
16 6      
17 7   -4  
18 8      
19 9      
20 10      

Suppose you prefer to extract all the source for the formulas in your FAME database. The following statements show the source of all formulas written to your SAS data set. The results are shown in Output 34.11.9 and Output 34.11.10. Another example of FAMEOUT=FORMULA option is shown in Example 34.6.

   libname lib8 sasefame "%sysget(FAME_DATA)"
      fameout=formula wildcard="?" ;
   
   data cforout;
      set lib8.alltypes;
   run;
   
   title2 'Contents of OUT=cforout';
   title3 'Using FAMEOUT=FORMULA option without range';
   proc contents 
      data=cforout;
   run;
   

Output 34.11.9 Contents of OUT=CFOROUT Using FAMEOUT=FORMULA and Open Wildcard
***famallt: FAMEOUT option, Different Type Values***
Contents of OUT=cforout
Using FAMEOUT=FORMULA option without range

The CONTENTS Procedure

Alphabetic List of Variables and Attributes
# Variable Type Len
1 S.DFRM Char 27
2 S.FRM1 Char 27
3 S.FRM2 Char 27

   title2 'ALLTYPES, FAMEOUT=FORMULA and open wildcard for FORMULA Series';
   title3 'OUT=CFOROUT from the PRINT Procedure';
   proc print 
      data=cforout noobs;
   run;

Output 34.11.10 Listing of OUT=CFOROUT Using FAMEOUT=FORMULA and Open Wildcard
***famallt: FAMEOUT option, Different Type Values***
ALLTYPES, FAMEOUT=FORMULA and open wildcard for FORMULA Series
OUT=CFOROUT from the PRINT Procedure

S.DFRM S.FRM1 S.FRM2
IF DBOO THEN DPRC ELSE DNUM IF BOO1 THEN NUM1 ELSE NUM2 IF BOO0 THEN DAT1 ELSE DAT2

If you want all series of every type, you can merge the resulting data sets together. For more about merging SAS data sets, see SAS Language Reference: Concepts.


Previous Page | Next Page | Top of Page