Published on :
Reporting CREATION_INTERNE

Creating and filtering a city table

This code is also available in: Deutsch Español Français
Awaiting validation
This program starts by creating a SAS© table named 'city' containing manually entered city/capital pairs. It then uses the PRINT procedure to list only cities whose capital is 'Delhi'.
Data Analysis

Type : CREATION_INTERNE


The data is provided directly in the source code via the CARDS statement.

1 Code Block
DATA STEP Data
Explanation :
Data step creating the 'city' table. Defines 'name' and 'capital' columns as character strings and reads inline data.
Copied!
1DATA city;
2INPUT name$ capital$;
3CARDS;
4Helsinki Finland
5delhi Delhi
6Mumbai Delhi
7Nice Paris
8;
9RUN;
2 Code Block
PROC PRINT
Explanation :
Print procedure displaying the content of the 'city' table. The WHERE clause filters the results to show only rows where the capital is 'Delhi'.
Copied!
1PROC PRINT DATA=city;
2where capital='Delhi';
3RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.