i have a code as below.
proc sql;
create table sel_me as
select *
question:why do we use select*
You don't have to.
The * is a wildcard. " select * " means " select everything " and sometimes that is easier than typing everything out. .
You don't have to.
The * is a wildcard. " select * " means " select everything " and sometimes that is easier than typing everything out. .
select *
from sashelpclass;
quit;
is the same as
specifying all the variables in the select statement
basically as short cut
Please run
Proc sql;
select *
from sashelp.class;
quit;
and
proc sql;
select Name, Sex, Age ,Height ,Weight
from sashelp.class;
quit;
to notice the result
Mostly because programmers are lazy and if there's a shorter way its much easier.
Please note that I've rewritten your subject line to be more descriptive. This will help anyone else looking for the same answer in the future.
The SAS SQL documentation is here:
And has plenty of examples that you can use. Your question would be covered here:
*
represents all columns in the tables or views that are listed in the FROM clause.
whenever you use * in the select clause of sql, it always means selecting all columns. In the contradictory you can also select particular columns.
Select * from table will select all coulmns
and
select col1,c0l2 from table
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.