title 'Countries in Europe';
select Name, Population format=comma10.
from sql.countries
where Continent = 'Europe';
/*-------------------------------------------------------------------
Output 2.23 Retrieving Rows Based on a Comparison
-------------------------------------------------------------------*/
proc sql;
title 'States with Populations over 5,000,000';
select Name, Population format=comma10.
from sql.unitedstates
where Population gt 5000000
order by Population desc;
/*-------------------------------------------------------------------
Output 2.24 Retrieving Rows That Satisfy Multiple Conditions
-------------------------------------------------------------------*/
proc sql;
title 'Countries in Africa with Populations over 20,000,000';
select Name, Population format=comma10.
from sql.countries
where Continent = 'Africa' and Population gt 20000000
order by Population desc;
/*-------------------------------------------------------------------
Output 2.25 Using the IN Operator
-------------------------------------------------------------------*/
proc sql outobs=12;
title 'World Mountains and Waterfalls';
select Name, Type, Height format=comma10.
from sql.features
where Type in ('Mountain', 'Waterfall')
order by Height;
/*-------------------------------------------------------------------
Output 2.26 Using the IS MISSING Operator
-------------------------------------------------------------------*/
proc sql;
title 'Countries with Missing Continents';
select Name, Continent
from sql.countries
where Continent is missing;
/*-------------------------------------------------------------------
Output 2.27 Using the BETWEEN-AND Operators
-------------------------------------------------------------------*/
proc sql outobs=12;
title 'Equatorial Cities of the World';
select City, Country, Latitude
from sql.worldcitycoords
398 Appendix 3 • Example Code Shown in Using the SQL Procedure