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

Hello All,

 

I want to combine 2 data sets as below and i am not sure how to use both where and Drop functions together for data set history.adm_ytd_pivot_2017.

It would be great help if you can assist me with this.

data adm_en4;
set adm_en3 history.adm_2017(where=( commence_year = '2017'));
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@BIDD wrote:

Hello All,

 

I want to combine 2 data sets as below and i am not sure how to use both where and Drop functions together for data set history.adm_ytd_pivot_2017.

It would be great help if you can assist me with this.

data adm_en4;
set adm_en3 history.adm_2017(where=( commence_year = '2017'));
run;

 


Just add the drop dataset options:

data adm_en4;
set
  adm_en3
  history.adm_2017 (
    drop=variables you want to drop
    where=(commence_year = '2017')
  )
;
run;

View solution in original post

6 REPLIES 6
Patrick
Opal | Level 21

If you want the where clause applied to all source data sets then you can write your code as below:

data adm_en4;
  set adm_en3 history.adm_2017;
  where commence_year = '2017';
run;

The way you've done it will only apply the where clause for the data set which goes with the where clause.

BIDD
Fluorite | Level 6

Hi,

i want to use Where  and drop clause only for history.adm_2017, no changes in adm_en3 data.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Then put them on the set part as you have done:

data adm_en4;
  set adm_en3 history.adm_2017(where=( commence_year = '2017') drop=...);
run;
BIDD
Fluorite | Level 6
Hi, thanks for the advice...it worked.
Kurt_Bremser
Super User

@BIDD wrote:

Hello All,

 

I want to combine 2 data sets as below and i am not sure how to use both where and Drop functions together for data set history.adm_ytd_pivot_2017.

It would be great help if you can assist me with this.

data adm_en4;
set adm_en3 history.adm_2017(where=( commence_year = '2017'));
run;

 


Just add the drop dataset options:

data adm_en4;
set
  adm_en3
  history.adm_2017 (
    drop=variables you want to drop
    where=(commence_year = '2017')
  )
;
run;
BIDD
Fluorite | Level 6

Hi, thanks for the advice...it worked.

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
  • 6 replies
  • 830 views
  • 0 likes
  • 4 in conversation