## Drop statement for dropping list of variables.

Solved
Occasional Contributor
Posts: 9

# Drop statement for dropping list of variables.

Got stuck with a problem related to Drop statement.attached herewith the problem and its 4 options.

Thanks

Accepted Solutions
Solution
‎08-09-2017 03:36 PM
Super User
Posts: 8,083

## Re: Drop statement for dropping list of variables.

The question specifically asked for how to specify the drop using dataset options.

All Replies
Super User
Posts: 23,700

Posts: 1,837

## Re: Drop statement for dropping list of variables.

There are two ways to use DROP statement:

1)  data wnat(DROP=var1 var2 ...);  /* with the equal sign */

set have;

... any code ...

run;

2)  data want;

set have;

... any code ...

DROP var1 var2 ...;        /* without the equal sign */

run;

Super User
Posts: 8,083

## Re: Drop statement for dropping list of variables.

Let's look at the choices.

B anc C are wrong because they have commas.

B and D are wrong because they dont have the equal sign that all dataset options require.

So A is the best answer.

But all four are wrong because the parenthesis themselves are not part of the DROP= dataset option.  If you have other dataset options, like LABEL= or RENAME= they would all be nested inside the single set of () following the dataset name.

Occasional Contributor
Posts: 9

## Re: Drop statement for dropping list of variables.

Hello Tom

But if we look at the given code its doesnt seem like a drop dataset option .

It looks like a statement so should it be the option D but ofcourse as you said without the () brackets.

Solution
‎08-09-2017 03:36 PM
Super User
Posts: 8,083

## Re: Drop statement for dropping list of variables.

The question specifically asked for how to specify the drop using dataset options.

Occasional Contributor
Posts: 9

## Re: Drop statement for dropping list of variables.

oops sorry ...You are right ......
Super User
Posts: 23,700

## Re: Drop statement for dropping list of variables.

rajvir wrote:

Hello Tom

But if we look at the given code its doesnt seem like a drop dataset option .

It looks like a statement so should it be the option D but ofcourse as you said without the () brackets.

A good rule of thumb if you're not certain about something is to check the documentation. You may not always understand exactly what it's saying, but the examples will often help with that. Reading through the examples may help with your understanding of the DROP dataset option, versus the DROP statement.

DROP, data step option

https://support.sas.com/documentation/cdl/en/ledsoptsref/69751/HTML/default/viewer.htm#n15goor3q758g...

DROP, statement

http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#n1capr0s7tilbvn...

Documentation examples/explanations:

http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p10jjd7e6qn396n1a22...

☑ This topic is solved.