LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 25 Dec 2008 12:44:48 -0800
Reply-To:     Tony <tonywof@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Tony <tonywof@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Need help with %qscan and %scan
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Hi All,

I had the following codes and there were running errors. The macro variables GRP1 and GRP2 were correctly resolved. However, I got this error 200 from the proc sql statement. After I change the %qscan to %scan, it worked! I thought I should use %qscan to mask the "-" in the macro variable OABYGROUP. How come it only works with %scan?

Thanks in advance. Tony

Error Message:

1 proc sql; select count(*) from a where &GRP1; quit; - 200 ERROR 200-322: The symbol is not recognized and will be ignored.

SAS Codes:

options nocenter formdlim=' ' nodate nonumber symbolgen mlogic; options obs=0;

%let OABYGROUP=%str(CAT="ACTIVES-SSG" CAT="ACTIVES-DC"); data a; CAT="ACTIVES-SSG"; mem_no="ABCDEFG"; run;

%macro a; %local g; %let g=1; %do %while(%length(%qscan(&OAbygroup,&g,%str( ))) GT 0); %let GRP&g=%qscan(&OAbygroup,&g,%str( )); %put &&GRP&g; %let g=%eval(&g + 1); %end; %let g=%eval(&g -1); %put &GRP1; %put &GRP2; proc sql; select count(*) from a where &GRP1;; quit; %mend; %a;


Back to: Top of message | Previous page | Main SAS-L page