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

hello

we use (select data.*) to choose those variables we want, but how can we do a selection to choose all variables but to exclude just one variable?

This question came up when i tried to merge two datasets by "id", but I got a warning msg said the "id" had already existed.

Then I have to manually rewrite the 'select' statement.

Any suggestion ? Thanks! se

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

That would work better using a RENAME dataset option.

create table want(drop=x) as

  select a.*,b.*

  from data1 a

     , data2(rename=(id=x)) b

  where a.id = b.x

;

View solution in original post

3 REPLIES 3
Reeza
Super User

I think there might be an option to turn off that warning but I don't recall.

One other method is to run it with the feedback option:

proc sql feedback;

     create table want as

select *

from sashelp.class;

quit;

Get the list from the log and then delete the one(s) you don't want.

Ksharp
Super User

You can rename it ,then drop it at the output datasets.

proc sql;

create table want(drop=x) as

select a.* , b.b1,b.b2,...., b.id as x

Tom
Super User Tom
Super User

That would work better using a RENAME dataset option.

create table want(drop=x) as

  select a.*,b.*

  from data1 a

     , data2(rename=(id=x)) b

  where a.id = b.x

;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 53332 views
  • 7 likes
  • 4 in conversation