Proc SQL [2-14]


Selecting Multiple Columns

FROM school;

We have learned how to select a single column from a SAS table.

Now, we will look at how to retrieve multiple columns using Proc SQL. 

[Reminder: if you haven't created the SCHOOL table, copy and run the code from the yellow box below in your SAS Studio.]​

Selecting multiple columns is fairly easy.

You simply list the columns in the SELECT clause separated by a comma.​


Proc sql;
select Name, Age,
from school;

In this example, student name, age and gender are listed in the SELECT clause.

​All three columns are retrieved and displayed in the output:​

​Note: each column is separated by a comma in the SELECT clause:

Selecting All Columns

You can also select all the columns by using the special character asterisk (*) in the SELECT clause.​


Proc sql;
select *
from school;

​The asterisk (*) tells SAS to select all of the columns from the SAS table.

All five columns from the SCHOOL table are displayed:


Locate the CARS table from the SASHelp library. 

Write a Proc SQL step to select the MAKE, MODEL and MSRP columns from the CARS table. 

Need some help?

Get Hint

Get Solution