BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lg2
Calcite | Level 5 lg2
Calcite | Level 5

i have a code as below.

 

proc sql;

create table sel_me as

  select *

 

 

 

question:why do we use select*

1 ACCEPTED SOLUTION

Accepted Solutions
HB
Barite | Level 11 HB
Barite | Level 11

You don't have to.

 

The * is a wildcard.  " select * " means " select everything " and sometimes that is easier than typing everything out. .

View solution in original post

4 REPLIES 4
HB
Barite | Level 11 HB
Barite | Level 11

You don't have to.

 

The * is a wildcard.  " select * " means " select everything " and sometimes that is easier than typing everything out. .

novinosrin
Tourmaline | Level 20

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

 

 

Reeza
Super User

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:

http://documentation.sas.com/?docsetId=sqlproc&docsetTarget=n1e51p1t33ruyyn1iyzqonf3r0cm.htm&docsetV...

 

And has plenty of examples that you can use. Your question would be covered here:

http://documentation.sas.com/?docsetId=sqlproc&docsetTarget=p0hwg3z33gllron184mzdoqwpe3j.htm&docsetV...

 

*

represents all columns in the tables or views that are listed in the FROM clause.

ruchi11dec
Obsidian | Level 7

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1332 views
  • 2 likes
  • 5 in conversation