I tried to type stuff like nofreq or notype, but that didnt work like how noobs would
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;
Or even simpler:
output out=Number_Of_Species_Observed (drop = _:) sum= ;
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;
Or even simpler:
output out=Number_Of_Species_Observed (drop = _:) sum= ;
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?
@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.
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.