BEA National Income and Product Accounts


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

                    SAS Sample Library

        Name: datex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The DATASOURCE Procedure

   Title: BEA National Income and Product Accounts
 Product: SAS/ETS Software
  System: Windows
    Keys: DATASOURCE  data extraction from various sources
   Procs: DATASOURCE
    Data: sasmisc: beanipa.data (DATASOURCE database files)
   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, DATASRC_DATA, to the path of your
          writeable folder containing
          the beanipa.data file.
          To assign a fileref to the external file to be processed,
          use the following form of the filename statement:

filename ascifile "%sysget(DATASRC_DATA)beanipa.data" recfm=v lrecl=108;
--------------------------------------------------------------*/

/*- assign fileref to the external file to be processed --------*/

filename ascifile "%sysget(DATASRC_DATA)beanipa.data" recfm=v lrecl=108;

title1 'Relation of Foreign Transactions to Balance of Payment Accounts';
title2 'Range from 1984 to 1989';

title3 'Annual';
proc datasource filetype=beanipa infile=ascifile
                interval=year
                outselect=off
                outkey=byfor4;

   range from 1984 to 1989;
   keep __00100 __00800;

   label __00100='Balance of Payment Accounts';
   label __00800='Exports of Goods and Services';

   rename __00100=BPAs __00800=exports;
run;

proc print data=byfor4;
run;

 /*- assign fileref to the external file to be processed --------*/

filename ascifile "%sysget(DATASRC_DATA)beanipa.data" recfm=v lrecl=108;

title1 'Relation of Foreign Transactions to Balance of Payment Accounts';
title2 'Range from 1984 to 1989';

title3 'Annual';
proc datasource filetype=beanipa infile=ascifile
                interval=year
                outselect=off
                outkey=byfor4
                out=foreign4;

   range from 1984 to 1989;
   keep __00100 __00800;

   label __00100='Balance of Payment Accounts';
   label __00800='Exports of Goods and Services';

   rename __00100=BPAs __00800=exports;

run;

proc contents data=foreign4;
run;
proc print data=foreign4;
run;