provide the ability to filter data using a 'begins with' type operator
What benefit would this have over using substr or =: ?
1913 data _null_ ;
1914 set sashelp.class ;
1915 if name =: 'Ro' ;
1916 put (_all_)(=) ;
1917 run ;
Name=Robert Sex=M Age=12 Height=64.8 Weight=128
Name=Ronald Sex=M Age=15 Height=67 Weight=133
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
Since this idea is for SAS Enterprise Guide, I'm assuming that you would like to see this in the Query Builder and other filter tools. You can achieve the effect today with the "Matches pattern" option, which generates the LIKE operator. It works like a wildcard. Specify the text you want to match on the "beginning" and end with a %:
Does this satisfy the request? It's slightly less intuitive than "Begins with", but much more flexible.
Theres no "Matches pattern" option in my basic filter. is there any other solution to this? Im working with numerics. Thanks
Not sure how you could code a "begins with" for a numeric field. What does it even mean mathematically?
Not sure how to do this using the query building tools.
You can convert a number to a string using the PUT() function. Since SAS can only uniquely stores numbers upto 15-17 digits () you could use something like
put(id,17.-l) in: ('46' '47')
Or more likely since the query building might be used PROC SQL you will need to use the SUBSTR() function instead.
substr(put(id,17.-l),1,2) in ('46' '47')
If your IDs are all of the same magnitude, say 10 digits, then you could use arithmetic on the original value.
int(id/10**8) in (46 47)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.