Resources

Sorting Time Series in Descending Order

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

                   SAS SAMPLE LIBRARY

       Name: wbgoex04.sas
Description: Example program from SAS/ETS User's Guide,
             The SASEWBGO Interface Engine
      Title: Sorting Time Series in Descending Order
    Product: SAS/ETS Software
       Keys: WBGO data extraction
      Procs: SASEWBGO
      Notes: Read this before you run this sample.
             The sample data provided resides in the ets/sasmisc folder.
             If you are using automap=READONLY, copy the
             map of your incoming XML data to a writeable folder before
             using it.

             Then you can define a system environment variable,
             WBGO, to the path of your  writeable folder containing
             the GDPDES.MAP file and GDPDES.xml.
             To assign a fileref to the external file to be processed,
             use the following form of the libname statement:

           libname wbgo sasewbgo "%sysget(WBGO)"
              OUTXML=gdpdes
              AUTOMAP=replace
              MAPREF=MyMap
              XMLMAP="%sysget(WBGO)gdpdes.map"
              COUNTRYLIST='chn;bra'
              IDLIST='NY.GDP.PCAP.CD,NY.GDP.PCAP.KN,NY.GDP.PCAP.PP.KD'
              RANGE='2010:2016'
              PER_PAGE=25
              SORT=desc
              FORMAT=xml
              ;
 ----------------------------------------------------------------*/

title 'Using the SORT= Option';
libname wbgo sasewbgo "<physical pathname>"
   OUTXML=gdpdes
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="<fully qualified filename to map file with .map file extension>"
   COUNTRYLIST='chn;bra'
   IDLIST='NY.GDP.PCAP.CD,NY.GDP.PCAP.KN,NY.GDP.PCAP.PP.KD'
   RANGE='2010:2016'
   PER_PAGE=25
   SORT=desc
   ;

data mygdpdesc;
     set wbgo.gdpdesc;
run;

proc contents data=mygdpdesc; run;
proc print data=mygdpdesc(drop=total_count); run;