/ Published in: SAS
You can use regular expressions within SQL. This can be quite powerful in selecting data that matches certain conditions. The following example shows a simple regular expression which selects only quarterly periods from a table containing years, quarters & months.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
data test ; length period $ 7 ; input period ; cards ; 2005 2005Q1 2005JAN ;; run ; proc sql; create table qtrs as select * from test where prxmatch("/\d\d\d\d[qQ][1-4]/",period) ; quit; proc print data=qtrs ; run ;
URL: http://jaredprins.squarespace.com/blog/2008/10/7/some-sas-code-snippets.html