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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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