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 (October 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 3 Oct 2005 13:29:58 -0400
Reply-To:     Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:      Re: WARNING: Apparent symbolic reference _K not resolved !!??
Comments: To: Sa Polo <solouga4@REDIFFMAIL.COM>

On Mon, 3 Oct 2005 16:18:07 -0000, sa polo <solouga4@REDIFFMAIL.COM> wrote:

>Thanks Chang,

I have used your edits to change my program but while i create a file using a FILE statement in a DATA STEP i get the WARNING: Apparent symbolic reference _K not resolved !!?? i would like to get rid of this message.

Also i need to invoke the macro through a CALL EXECUTE as i am reading the Id from within a DATA STEP.

Any help is much appreciated as usual.

proc format; value fname 0801 = "S & K" ; run;

%macro fname(id); %*-- returns filename based on the input number --*; %local number name;

%let number = %sysfunc(putn(&id., z4.)); %let name = %qsysfunc(putn(&id., fname.)); %let name = %qsysfunc(strip(&name.)); %let name = %qsysfunc(translate(&name., "_", " ")); /* %*;&number.-&name.*/ %put test= "&number.-&name."; DATA _NULL_; FILE "c:\&number.-%SUPERQ(name).csv";

RUN; %mend fname;

DATA _NULL_; CALL EXECUTE('%fname('||801||')'); RUN;

Hi, Sa,

The macro as I wrote it is fine -- it returns a quoted string. The problem is that the call execute seems to resolve everything. And if you think of it a minuite, why not? It expects a character string, and thus the macro quoting is stripped away to produce a string for the call routine. Thus the call execute only sees (un)masked strings only.

Well, if this is the case, then what you have to do is to force it to see a quoting function as a part of the string. It is easy -- Something like below. I know it works, but there are probably other people who can explain how it works much better than I can. HTH.

Cheers, Chang

proc format; value fname 0801 = "S & K" ; run;

%macro fname(id); %*-- returns filename based on the input number --*; %local r number name; %let number = %sysfunc(putn(&id., z4.)); %let name = %qsysfunc(putn(&id., fname.)); %let name = %qsysfunc(strip(&name.)); %let name = %qsysfunc(translate(&name., '_', ' ')); %nrstr(%%nrstr%()c:\&number.-&name..csv;%nrstr(%)) %mend fname;

%put fname=%fname(801);

data _null_; id = 801; call execute('data _null_;'); call execute(' file "' || '%fname(' || put(id,best.) || ')";'); call execute('run;'); run;

/* on log NOTE: CALL EXECUTE generated line. 1 + data _null_; 2 + file "%nrstr(c:\0801-S_&_K.csv;)"; 3 + run;

NOTE: The file "c:\0801-S_&_K.csv;" is: File Name=c:\0801-S_&_K.csv;, RECFM=V,LRECL=256

NOTE: 0 records were written to the file "c:\0801-S_&_K.csv;". */


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