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

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

4 REPLIES 4
confused_saser
Obsidian | Level 7

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?

 

 

 

 

ballardw
Super User

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.

confused_saser
Obsidian | Level 7

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!

SASKiwi
PROC Star

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.  

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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