So I am trying to understand how best to do this using Perl. I have some sample data which I want to read in as a data step.
So
Data work.test; set work.PerlData; run;
However I want to use the following
prxparse('/spa/');
I am just not sure how to use this Perl script to show me all hotel names with Spa within it.
Excel file looks like: (all fictious data) Just trying to understand Perl before I try it with real data.
| Hotel_Name | Company | Phone | Manager | |
| Ivory Courtyard Resort | Ac Metus Vitae LLC | (140) 462-6599 | Felicia Hutchinson | [email protected] |
| Sunrise Mirror Resort | Quisque Tincidunt Company | (544) 574-0753 | Hollee Clayton | [email protected] |
| Crimson Shore Hotel | Et Netus Et Consulting | (931) 720-2951 | Pascale Bell | [email protected] |
| Pleasant Circus Resort & Spa | Ut Sem LLP | (262) 723-5866 | Leonard Middleton | [email protected] |
| Lord's Plains Hotel | Et Netus Corporation | (673) 576-3366 | Zeus Chan | [email protected] |
| Noble Refuge Hotel | Donec Corporation | (110) 924-8302 | Leilani Shelton | [email protected] |
| Revelation Hotel & Spa | Aliquam Tincidunt Nunc Corp. | (559) 588-0513 | Armand Bishop | [email protected] |
| Countryside Hotel | Purus Company | (241) 761-4967 | Seth Slater | [email protected] |
| Panorama Hotel & Spa | Adipiscing Incorporated | (113) 803-4658 | Tamekah Conrad | [email protected] |
| Stellar Hotel & Spa | Magnis Dis Parturient Associates | (515) 575-5373 | Forrest Haley | [email protected] |
| Northern Obelisk Hotel | Nec Associates | (320) 680-9409 | Kim Malone | [email protected] |
| Western Thicket Resort & Spa | Felis Orci Adipiscing Corporation | (713) 874-6161 | Wang Melendez | [email protected] |
| Noble Heritage Hotel | Nostra Per LLC | (918) 899-8305 | Ira Thompson | [email protected] |
| Ruby Mansion Resort | Eu Dui Associates | (110) 805-0328 | Tobias Britt | [email protected] |
if prxmatch('/\bspa\b/i',hotel_name) then output;
The function prxparse checks the syntax of a regular expression, it does not check wether a something matches the expression. You need to use prxmatch for that.
Thank you, what would the syntax be for PRXMatch?
if prxmatch('/\bspa\b/i',hotel_name) then output;
Thank you! Just starting to get my head wrapped around the syntax
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.