BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hz16g22
Obsidian | Level 7

I tried to type stuff like nofreq or notype, but that didnt work like how noobs would

hz16g22_0-1678659846312.png

 

this is the code

10   proc means data=amphibians noprint;
11       var Green_frogs Brown_frogs Common_toad Fire_bellied_toad
12           Tree_frog Common_newt Great_crested_newt;
13       output out=Number_Of_Species_Observed sum= / ;
14       title "Number of Species Observed";
15   run;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Or even simpler:

 

 output out=Number_Of_Species_Observed (drop = _:) sum= ;
--
Paige Miller

View solution in original post

5 REPLIES 5
SASKiwi
PROC Star
proc means data=amphibians noprint;
  var Green_frogs Brown_frogs Common_toad Fire_bellied_toad
       Tree_frog Common_newt Great_crested_newt;
  output out=Number_Of_Species_Observed (drop = _type_ _freq_) sum= / ;
  title "Number of Species Observed";
run;
PaigeMiller
Diamond | Level 26

Or even simpler:

 

 output out=Number_Of_Species_Observed (drop = _:) sum= ;
--
Paige Miller
hz16g22
Obsidian | Level 7

Thanks,

Just to know, what does the colon mean in this case? cos it seems like it would work the same if i put a "%" instead, or does not work?

PaigeMiller
Diamond | Level 26

@hz16g22 wrote:

Thanks,

Just to know, what does the colon mean in this case? cos it seems like it would work the same if i put a "%" instead, or does not work?


The colon in (drop=_:) indicates all variables whose names that begin with an underscore. Had I typed something different, such as (drop=age:) the colon indicates all variables whose names begin with age. You can use the colon any place where SAS can accept a list of variable names. It also works on SAS data set names.

--
Paige Miller
ballardw
Super User

Note that data set options are available pretty much anywhere you have a data set used for input or output.

The options would go in () immediately following the set name. In this case you want to DROP variables but you can do a number of other things. It is worth looking at the documentation as these are extremely useful.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1581 views
  • 4 likes
  • 4 in conversation