SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

MACRO / Unbalanced quotation marks WARNING

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 138
Accepted Solution

MACRO / Unbalanced quotation marks WARNING

This is to fit standard code to my data with modifications. It works fine out of macro. But it warns as below when i throw the hard code into the macro. And it takes forever. Run never ends. It probably would end eventually had I waited longer. I cancelled submitted statements when it's beyond 20 min. 

 

NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation marks. 

 

proc import datafile="...\icd.csv" out=icd_10 dbms=csv replace; getnames=yes; run;

data code_list(rename=x=icd); set icd_10;
 format x $10.;
  icd10=compress(icd10,'.');
  icd_10_original=icd10;
 x="[*]"||icd10;
run;

proc sql noprint;
   select  icd
     into :codes separated by '|'
     from  code_list;
quit;

%put &codes;
options compress=yes;
%let x=:Item_1 - :Item_5;

/*****************************************************************************************************************/;
libname read_in "...";
libname read_op "...";
libname in_iden "...";

%macro loop(case);

%global case1;
%let case1=&case;
%if &case=Other                        %then %let condition = &codes;

proc datasets noprint;
delete all_&class._other;
run;
 
%do year = 2015 %to 2017; 
%if &year >= 2015 %then 
  %do; 
    libname read_in "...";
     %if &class=Inside %then %let file=&class._s_;
	  %else;
     %if &class=Outside %then %let file=&class._s_prime_;
   %end; 

data temp(compress=yes); set read_in.&file&year(where=(patient_state="NY" and substr(left(Admission_Start_Care_Date),1,4)="2015"));
icd_code = catx('*','*',Primary_Item, of Item:); 
if prxmatch("m/&condition/oi",icd_code) > 0; 
source="Inside";
run;

proc append base=all_&class._other(compress=yes) data=temp force;
run;

%end;
%mend loop;

%let class=Inside;
%loop(Other);

%let class=Outside;
%loop(Other);

Any hints are appreciated.

Thank you very much in advance. 


Accepted Solutions
Solution
‎06-28-2017 04:25 PM
Super User
Posts: 19,780

Re: MACRO / Unbalanced quotation marks WARNING

[ Edited ]

Errors start on Page 7 of the log, when year=2015.

Why is that step failing?

 

data temp(compress=yes); 
set read_in.&file&year(where=(patient_state="NY" and substr(left(Admission_Start_Care_Date),1,4)="2015"));
icd_code = catx('*','*',Primary_Item, of Item:); if prxmatch("m/&condition/oi",icd_code) > 0; source="Inside";
run;

 

 

 

View solution in original post


All Replies
PROC Star
Posts: 7,471

Re: MACRO / Unbalanced quotation marks WARNING

I didn't see any unbalanced quotes. Suggestion: save your code, close then reopen a new SAS session, submit: options mprint mlogic symbolgen;, then run your code and, if you still get an error, post your log.

 

Art, CEO, AnalystFinder.com

Moderator
Posts: 252

Re: MACRO / Unbalanced quotation marks WARNING

Agree with @art297, please post the log.

 

But please also post a sample of the CSV file you are importing.

 

Plus I don't see any macro logic if the input data set is empty - could it sometimes be? Or could the headings (and therefore the field names be incorrect) resulting in an empty codes macro variable?

 

Super User
Posts: 11,343

Re: MACRO / Unbalanced quotation marks WARNING

How long was the result of your %put of the Codes variable?

 

I'm not sure just how many ICD-10 codes there are but I'm pretty sure that concatenating even a small percentage will generate a string much longer than the 260 or so that triggers that warning.

 

Without following all of your steps where you turned hard code into a macro it is hard to guess where the long run time would come from.

 

Since this is apparently a look up it may be that an sql join or hash look up might be a better choice. You might be able to use your code_list data set more directly.

Frequent Contributor
Posts: 138

Re: MACRO / Unbalanced quotation marks WARNING

[ Edited ]

Hi guys,

Thanks for getting back to me. 

Attached SAS log and %put code file. The code was just run and I haven't looked at the log yet. Will do now. Please also let me know how this guy "options mprint mlogic symbolgen;" made this difference 

 

PS: 

ICD-10 code list consisted of 298 codes where half of these are icd-9 thus numeric whereas half of them icd-10 thus characteristic. 

 

 

PROC Star
Posts: 7,471

Re: MACRO / Unbalanced quotation marks WARNING

Haven't looked at your log, yet, but those options simply provide extra feedback regarding the entire process. They are invaluable in discovering where things may have gone wrong.

 

Art, CEO, AnalystFinder.com

 

Frequent Contributor
Posts: 138

Re: MACRO / Unbalanced quotation marks WARNING

[ Edited ]

SAS log is attached here. Because it's too long to copy and paste in here. I noticed libname was not correctly used as defined. No idea how it happened. What else am I missing here? Million thanks. 

Solution
‎06-28-2017 04:25 PM
Super User
Posts: 19,780

Re: MACRO / Unbalanced quotation marks WARNING

[ Edited ]

Errors start on Page 7 of the log, when year=2015.

Why is that step failing?

 

data temp(compress=yes); 
set read_in.&file&year(where=(patient_state="NY" and substr(left(Admission_Start_Care_Date),1,4)="2015"));
icd_code = catx('*','*',Primary_Item, of Item:); if prxmatch("m/&condition/oi",icd_code) > 0; source="Inside";
run;

 

 

 

Super User
Posts: 7,771

Re: MACRO / Unbalanced quotation marks WARNING

[ Edited ]

SUNY_Maggie wrote:

SAS log is attached here. Because it's too long to copy and paste in here. I noticed libname was not correctly used as defined. No idea how it happened. What else am I missing here? Million thanks. 


Note that the SAS log is pure text and should therefore be posted in a text file and not a Word document. MS Office files are blocked in many places by the firewalls for security reasons. This means that, by posting a Word document, you automatically reduce the number of possible helpers for your problem.

If a txt file is too large for posting, put it in a zip archive.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 7,471

Re: MACRO / Unbalanced quotation marks WARNING

I noticed one problem at line 216, namely:

216      libname read_in "P:\

and then another on page 7 of the log:

SYMBOLGEN:  Macro variable CONDITION resolves to             [*]V271|...|[*]7799/oi",icd_code)  > 0;

Both are showing unbalanced quotation marks

 

Art, CEO, AnalystFinder.com

Valued Guide
Posts: 2,177

Re: MACRO / Unbalanced quotation marks WARNING

Try a %THEN %DO ;
before the line
PROC DATASETS NOPRINT;
Valued Guide
Posts: 2,177

Re: MACRO / Unbalanced quotation marks WARNING

Apols
Couldn't see the off-screen text
Frequent Contributor
Posts: 138

Re: MACRO / Unbalanced quotation marks WARNING

I took it down due to confidentiality reason. dealing with individual patient data and couldn't mask it off well in 14 page log. It worked out now though, the problem was when I define data to 2015. i didn't have physical data existed for that year. Thanks Peter.
☑ This topic is solved.

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

Discussion stats
  • 12 replies
  • 630 views
  • 5 likes
  • 7 in conversation