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

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

Please help me to find 1.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

 

image.png

View solution in original post

7 REPLIES 7
Reeza
Super User

Post your questions directly into the forum, not as attachments. Many users will not download attachments. 

Shmuel
Garnet | Level 18

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;

Tom
Super User Tom
Super User

Let's look at the choices.

image.png

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.

rajvir
Fluorite | Level 6

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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. 

Tom
Super User Tom
Super User

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

 

image.png

rajvir
Fluorite | Level 6
oops sorry ...You are right ......
Reeza
Super User

@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...

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

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