SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
data indian(drop=MaxWindMPH) atlantic(drop=MaxWindKM) pacific;
	set pg2.storm_summary(drop=MinPressure); *Notice where drop is here;
	
	*drop=MinPressure; *This does not work? I have to include it into the set statement, but according to picture (see below) I should not have to?;
	
	length Ocean $ 8;
	Basin=upcase(Basin);
	StormLength=EndDate-StartDate;
	MaxWindKM=MaxWindMPH*1.60934;
	if substr(Basin,2,1)="I" then do;
		Ocean="Indian";
		output indian;
	end;
	else if substr(Basin,2,1)="A" then do;
		Ocean="Atlantic";
		output atlantic;
	end;
	else do;
		Ocean="Pacific";
		output pacific;
	end;
run;

SasStatistics_0-1621335638686.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
drop=MinPressure;

is not valid syntax. If you remove the equal sign, it should work. (When you use DROP as a data set option as in a SET statement, then the equal sign is required)

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26
drop=MinPressure;

is not valid syntax. If you remove the equal sign, it should work. (When you use DROP as a data set option as in a SET statement, then the equal sign is required)

--
Paige Miller
Kurt_Bremser
Super User

The DROP statement is its own statement and cannot be part of another statement.

The DROP= dataset option can be part of any dataset specification (SET, MERGE, DATA, DATA=, CREATE TABLE AS, FROM).

STRONGLY suggest you use the SAS documentation for your further studies, particularly the DROP Statement 

AMSAS
SAS Super FREQ

@SasStatistics 
From the screenshot, it looks like you are taking some training. I would suggest that you go back over the Directing DATA Step Output section, as it probably explained the difference between Drop Statement and Drop Data Set Option.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 3 replies
  • 875 views
  • 3 likes
  • 4 in conversation