Specifying Two Series Ids with Multiple Vintage Dates

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

                   SAS SAMPLE LIBRARY

       Name: fredex06.sas
Description: Example program from SAS/ETS User's Guide,
             The SASEFRED Interface Engine
      Title: Specifying Two Series Ids with Multiple Vintage Dates
             Using Output=2 Option and Descending Sort Order
    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 system environment variable,
             FRED, to the path of your  writeable folder containing
             the FREDEX06.MAP file and FREDEX06.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=fredex06
              AUTOMAP=replace
              MAPREF=MyMap
              XMLMAP="%sysget(FRED)fredex06.map"
              APIKEY='<your FRED apikey>'
              IDLIST='ADJRES,ADJRESN'
              VINTAGE='2003-07-31,2006-08-31,2013-06-13'
              START='2004-01-01'
              END='2012-12-01'
              FREQ='bw'
              OUTPUT=2
              AGG='avg'
              SORT='desc'
              FORMAT=xml
              ;
 ----------------------------------------------------------------*/

options validvarname=any
   sslcalistloc="/SASSecurityCertificateFramework/1.1/cacerts/trustedcerts.pem";

title 'Specifying Two Series IDs with Multiple Vintage Dates and Descending Sort Order';
libname _all_ clear;

libname fred sasefred "%sysget(FRED)"
   OUTXML=fredex06
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="%sysget(FRED)fredex06.map"
   APIKEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   IDLIST='ADJRES,ADJRESN'
   VINTAGE='2003-07-31,2006-08-31,2013-06-13'
   START='2004-01-01'
   END='2012-12-01'
   FREQ='bw'
   OUTPUT=2
   AGG='avg'
   SORT='desc'
   FORMAT=xml;

data fredPDD;
   set fred.fredex06;
run;

proc contents data=fredPDD; run;

%macro pri20nom(datname);
data lastob;
   set &datname nobs=last;
   last10=last-9;
   if last>20 then
      call symput('print10',last10);
   else
      call symput('print10',19);
run;
data getall20;
   set &datname(obs=10) &datname(firstobs=&print10);
run;
proc print data=getall20; run;
%mend pri20nom;

title3 "First 10/Last 10 Obs, IDLIST=ADJRES,ADJRESN, and SORT=Descending";
%pri20nom(fredPDD);