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: 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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 53483 views
  • 7 likes
  • 4 in conversation