hyphen and colon can effectively express a range, such as
input name $1-6 /*6 positions for a name
array score (4) score1-score4;
var1=sum(of col2-col11, of col13-col30);
sheet="name-class $A2:C6" /*a data range of the excel sheet of class
'A' - 'F'; letters range from A to F
'A-F' a string of three characters.
Any other cases?
There's the double-hyphen which can be used for variable lists to denote you want consecutive variables from a data set.
proc print data=sashelp.class; var age--weight; run;
and a variation if you only want numeric variables in the variable list
proc print data=sashelp.baseball(obs=20); var name team crbb-numeric-salary; run;
and a similar (and obvious) modification gets you all of the character variables in the list of variables.
[a-z] describes a range of characters in a regular expression
:Var1 - :Var4 describes a range of macro variable names in proc SQL, as in
select style, sqfeet into :type1 - :type4 notrim, :size1 - :size3 from sasuser.houses;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
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.