BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
IgawaKei29
Quartz | Level 8

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 Email
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
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

if prxmatch('/\bspa\b/i',hotel_name) then output;

View solution in original post

4 REPLIES 4
andreas_lds
Jade | Level 19

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.

IgawaKei29
Quartz | Level 8

Thank you, what would the syntax be for PRXMatch?

Ksharp
Super User

if prxmatch('/\bspa\b/i',hotel_name) then output;

IgawaKei29
Quartz | Level 8

Thank you!  Just starting to get my head wrapped around the syntax

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1574 views
  • 0 likes
  • 3 in conversation