Prxmatch and reaching the 262 limit

Accepted Solution Solved
Reply
Contributor
Posts: 37
Accepted Solution

Prxmatch and reaching the 262 limit

I have to flag for a list of medications in a character variable which contains user entered free form text. The variable is the question "what prescription medications are you taking".

 

I have a list of opioids that I need to flag for but when I do my prxmatch I get the error

 

" The quoted string currently being processed has become more than 262 characters long"

 

My list of opioids are very long, probably about 40 meds and I don't know how to get around this.

 

This is the code I was using:

 

 

data opioid_analysis;
	set medeval.opioid;

/*Opiod Flagging*/

	if prxmatch("m/Butrans|Codeine|Dalmacol|Demerol\/pethidine|Dilaudid|Dimetapp-C|Dimethane|Duragesic|Hycodan|Hydromorph Contin|Kadian|Lenoltec|Methadone|Methoxacet/oi", MED_REC_PMED1)> 0 then opioid = 1;
	else opioid=0;
run;

 

If I keep adding medications I get the error.

 

How can I get around this?

 


Accepted Solutions
Solution
‎12-13-2016 10:09 PM
Grand Advisor
Posts: 10,215

Re: Prxmatch and reaching the 262 limit

The "limit" is much longer. What you received was not an error. It was a warning. Some times people forget to close a quoted string properly such as:

 

If x ='some text;    <= Not missing '

And more code goes here, several lines for over 250 some characters;

Variable = 'Another string'; 

So the first assignment doesn't end until the ' before "Another".

 

The warning reminds you to check for something like that. The specific semi-example I provided would generate other errors but you can't be sure it will all the time.

View solution in original post


All Replies
Contributor
Posts: 37

Re: Prxmatch and reaching the 262 limit

I think I figured it out!

 

I added the options noquotelenmax; before my datastep and it seems to work.

 

options noquotelenmax;
data opioid_analysis;
	set medeval.opioid;

/*Opiod Flagging*/

	if prxmatch("m/Butrans|Codeine|Dalmacol|Demerol\/pethidine|Dilaudid|Dimetapp-C|Dimethane|Duragesic|Hycodan|Hydromorph Contin|Kadian|Lenoltec|Methadone|Methoxacet|Methoxisal C1\/8|Methoxisal C1|MS contin|Novahistex DH|Novahistine DH|Nucynta|Oxycontin|OXY-IR|OxyNEO|Percocet/oi", MED_REC_PMED1)> 0 then opioid = 1;
	else opioid=0;
run;

 

 

I can't see any problems with this if anyone else can comment?

 

Why does sas bother putting a limit on strings?

 

 

 

 

Solution
‎12-13-2016 10:09 PM
Grand Advisor
Posts: 10,215

Re: Prxmatch and reaching the 262 limit

The "limit" is much longer. What you received was not an error. It was a warning. Some times people forget to close a quoted string properly such as:

 

If x ='some text;    <= Not missing '

And more code goes here, several lines for over 250 some characters;

Variable = 'Another string'; 

So the first assignment doesn't end until the ' before "Another".

 

The warning reminds you to check for something like that. The specific semi-example I provided would generate other errors but you can't be sure it will all the time.

Contributor
Posts: 37

Re: Prxmatch and reaching the 262 limit

Oh that is so weird.

 

I didn't change my code at all but just added the 

 

options noquotelenmax;


And my code works after having added that!

Respected Advisor
Posts: 3,063

Re: Prxmatch and reaching the 262 limit

Your code works regardless of the log warning and as @ballardw states the log message is a warning only and the option allows you to switch it off.  

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 195 views
  • 4 likes
  • 3 in conversation