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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 52712 views
  • 7 likes
  • 4 in conversation