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 | blandit.Nam.nulla@commodoauctor.edu |
Sunrise Mirror Resort | Quisque Tincidunt Company | (544) 574-0753 | Hollee Clayton | lacinia.at@interdumlibero.edu |
Crimson Shore Hotel | Et Netus Et Consulting | (931) 720-2951 | Pascale Bell | sapien@vulputate.co.uk |
Pleasant Circus Resort & Spa | Ut Sem LLP | (262) 723-5866 | Leonard Middleton | elementum.at.egestas@infelisNulla.com |
Lord's Plains Hotel | Et Netus Corporation | (673) 576-3366 | Zeus Chan | sagittis.felis.Donec@lobortistellus.edu |
Noble Refuge Hotel | Donec Corporation | (110) 924-8302 | Leilani Shelton | rhoncus@interdum.com |
Revelation Hotel & Spa | Aliquam Tincidunt Nunc Corp. | (559) 588-0513 | Armand Bishop | eros.Nam.consequat@Aliquameratvolutpat.org |
Countryside Hotel | Purus Company | (241) 761-4967 | Seth Slater | Duis.elementum.dui@eu.net |
Panorama Hotel & Spa | Adipiscing Incorporated | (113) 803-4658 | Tamekah Conrad | ligula.Donec@Nunccommodo.com |
Stellar Hotel & Spa | Magnis Dis Parturient Associates | (515) 575-5373 | Forrest Haley | eu.elit.Nulla@ultriciesdignissimlacus.com |
Northern Obelisk Hotel | Nec Associates | (320) 680-9409 | Kim Malone | cursus.et@ametmetusAliquam.ca |
Western Thicket Resort & Spa | Felis Orci Adipiscing Corporation | (713) 874-6161 | Wang Melendez | leo.in@Uttinciduntorci.net |
Noble Heritage Hotel | Nostra Per LLC | (918) 899-8305 | Ira Thompson | Sed@Proinsed.edu |
Ruby Mansion Resort | Eu Dui Associates | (110) 805-0328 | Tobias Britt | enim@orcitincidunt.edu |
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
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.