Resources

Retrieving Balance of Payment Basis Data For Exports and

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

                   SAS SAMPLE LIBRARY

       Name: fredex01.sas
Description: Example program from SAS/ETS User's Guide,
             The SASEFRED Interface Engine
      Title: Retrieving Balance of Payment Basis Data For Exports and
             Imports of Goods and Services
    Product: SAS/ETS Software
       Keys: FRED data extraction
      Procs: SASEFRED
      Notes: Read this before you run this sample.
             The sample data provided resides in the ets/sasmisc folder.
             If you are using automap=READONLY, then you must copy the
             map of your incoming XML data to a writeable folder before
             using it. So, define a Windows system environment variable
             ,FACTSET, to the path of your  writeable folder containing
             the FREDEX01.MAP file and FREDEX01.xml.
             To assign a fileref to the external file to be processed,
             use the following form of the libname statement:

           libname fred sasefred "%sysget(FRED)"
              OUTXML=fredex01
              AUTOMAP=replace
              MAPREF=MyMap
              XMLMAP="%sysget(FRED)fredex01.map"
              APIKEY='<your FRED apikey>'
              IDLIST='bopxgs,bopmgs'
              START='1997-01-01'
              END='2012-01-01'
              FREQ='a'
              OUTPUT=1
              AGG='avg'
              FORMAT=xml
              ;
 ----------------------------------------------------------------*/

title 'Retrieve Balance of Payment Data for the Exports and Imports';
libname _all_ clear;

libname fred sasefred "%sysget(FRED)"
   OUTXML=fredex01
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="%sysget(FRED)fredex01.map"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   IDLIST='bopxgs,bopmgs'
   START='1997-01-01'
   END='2011-01-01'
   FREQ='a'
   OUTPUT=1
   AGG='avg'
   FORMAT=xml;

data export_import;
   set fred.fredex01 ;
run;

proc contents data=export_import; run;
proc print data=export_import; run;