Retrieving the Entire Range of Data Observations in One Page
/*----------------------------------------------------------------
SAS SAMPLE LIBRARY
Name: wbgoex09.sas
Description: Example program from SAS/ETS User's Guide,
The SASEWBGO Interface Engine
Title: Retrieving the Entire Range of Data Observations in One Page
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 WLDCOMM.MAP file and WLDCOMM.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=gdpMall
AUTOMAP=replace
MAPREF=MyMap
XMLMAP="%sysget(WBGO)gdpMall.map"
COUNTRYLIST='all'
IDLIST='NY.GDP.PCAP.CD,NY.GDP.PCAP.KN,NY.GDP.PCAP.PP.KD'
RANGE='2010:2016'
PER_PAGE=50
PAGE=1
FORMAT=xml;
----------------------------------------------------------------*/
title 'Retrieve the Entire Range of Data Observations in One Page';
%macro x(per_page=);
%let i=&per_page;
%if &i<=50 %then %do;
libname wbgo sasewbgo "<physical path name>"
OUTXML=gdpMall
AUTOMAP=replace
MAPREF=MyMap
XMLMAP="<fully qualified file name to map file with .map file extension>"
COUNTRYLIST='all'
IDLIST='NY.GDP.PCAP.CD,NY.GDP.PCAP.KN,NY.GDP.PCAP.PP.KD'
RANGE='2010:2016'
PER_PAGE=&i
PAGE=1;
data mygdpMall;
set wbgo.gdpMall;
run;
proc contents data=mygdpMall; run;
proc print data=mygdpMall; run;
proc sql noprint;
select t.total_count into :allnobs
from work.mygdpMall t;
quit;
%if &allnobs>50 %then %do;
libname wbgo sasewbgo "<physical path name>"
OUTXML=gdpTall
AUTOMAP=replace
MAPREF=MyMap
XMLMAP="<fully qualified file name to map file with .map file extension>"
COUNTRYLIST='all'
IDLIST='NY.GDP.PCAP.CD,NY.GDP.PCAP.KN,NY.GDP.PCAP.PP.KD'
RANGE='2010:2016'
PER_PAGE=&allnobs
PAGE=1;
data mygdpTall;
set wbgo.gdpTall;
run;
%end;
%end;
%mend;
%x(per_page=50); /* call the X macro with PER_PAGE=50 */
proc contents data=mygdpTall; run;
proc print data=mygdpTall(drop=total_count firstobs=1800 obs=1848); run;