Resources

Using the GROUP Option to Subset Time Series


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

                    SAS Sample Library

        Name: havex10.sas
 Description: Example program from SAS/ETS User's Guide,
              The SASEHAVR Interface Engine
    Title: Using the GROUP Option to Subset Time Series 
  Product: SAS/ETS Software
     Keys: SASEHAVR
    Procs:
    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, HAVER_DATA, to the path of your                
           writeable folder containing                                
           the haverw.dat and haverw.idx files (Haver database files).                                     
           To assign a fileref to the external file to be processed,  
           use the following form of the libname statement:
       
libname lib1 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq 
        start=20040102 
        end=20041001 
        group="F*";
----------------------------------------------------------------*/

libname lib1 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq 
        start=20040102 
        end=20041001 
        group="F*";

data hwoutwA;
   set lib1.haverw;
run;

title1 'Haver Analytics Database, Frequency=week.6, infile=haverw.dat';
title2 '   Define a range inside the data range for OUT= dataset';          
title3 '   Using the START=20040102 END=20041001 LIBNAME options.';          
title4 '   Subset further: Using group="F*" LIBNAME option';              
proc print data=hwoutwA;
run;



libname lib2 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq start=20040102 
        end=20041001 
        group="M*";
        
data hwoutwB;
   set lib2.haverw;
run;
  
title1 'Haver Analytics Database, Frequency=week.6, infile=haverw.dat';
title2 '   Define a range inside the data range for OUT= dataset';        
title3 '   Using the START=20040102 END=20041001 LIBNAME options.';        
title4 '   Subset further: Using group="M*" LIBNAME option';            
proc print data=hwoutwB;
run;
libname lib3 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq 
        start=20040102 
        end=20041001 
        group="E*";

data hwoutwC;
   set lib3.haverw;
run;

title1 'Haver Analytics Database, Frequency=week.6, infile=haverw.dat';
title2 '   Define a range inside the data range for OUT= dataset';        
title3 '   Using the START=20040102 END=20041001 LIBNAME options.';        
title4 '   Subset further: Using group="E*" LIBNAME option';            
proc print data=hwoutwC;
run;