|Date: ||Wed, 18 Jul 2007 18:38:20 +0000|
|Reply-To: ||toby dunn <tobydunn@HOTMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||toby dunn <tobydunn@HOTMAIL.COM>|
|Subject: ||Re: Macro Fails in X Command|
|Content-Type: ||text/plain; format=flowed|
There three ways I can thing of to signal that the end of a macro variable
name. A period as you have mentioned, another macro variable or invoke a
%Macro, and a space.
x %Str(%')copy "&path.&file" "&path.G1073211.DOC" %Str(%') ;
Works if Paul doesnt want a period between teh resolved values of &path and
This also works:
&path.G1073211.DOC if Paul doesnt want a period between the resolved value
of &Path and G1073211
If anything simply cannot go wrong, it will anyway. Murphys Law #2.
The buddy system is essential to your survival; it gives the enemy somebody
else to shoot at.
Murphys Law #
Tell a man there are 300 billion stars in the universe and he'll believe
you. Tell him a bench has wet paint on it and he'll have to touch to be
sure. Murphys Law #9
From: "NOMAIL Roger S. Clark" <roger.s.clark@CENSUS.GOV>
Subject: Re: Macro Fails in X Command
Date: Wed, 18 Jul 2007 13:50:15 -0400
> Date: Wed, 18 Jul 2007 11:25:54 -0400
> From: Paul St Louis <pstloui@DOT.STATE.TX.US>
> Subject: Macro Fails in X Command
> I have SAS 9.1 on XP_Pro platform. Why does this code not work?
> %let path=U:\Contract_Letting\Letting_Duties\General_Notes\TEST;
> %let file=G1073211.rtf;
> data _null_;
> x %Str(%')copy "&path.&file" "&path.G1073211.DOC" %Str(%') ;
> Error Message:
> Windows cannot find 'copy
> U:\Contract_Letting\Letting_Duties\General_Notes\TEST\G1073211.DOC '.
> Make sure you typed the name correctly, and then try again. To search for
> file, click the Start button, and then click Search.
> All my little % and ' and " seem to be set up right.
I don't know if this will solve your problem, but one thing I noticed right
away is that you aren't terminating the macro variables correctly. There
are several ways that SAS knows that it is through reading a macro
variable. when you reference x %Str(%')copy "&path.&file"
"&path.G1073211.DOC" %Str(%') ; the period is "eaten up" by SAS to end the
macro variable. you need one period to signal SAS that the end of the
macro variable name has been reached, then another to be written to make
the two level file name. like this:
x %Str(%')copy "&path..&file" "&path..G1073211.DOC" %Str(%') ;
Roger S. Clark
Address Coverage Assurance Programs Branch
Need a brain boost? Recharge with a stimulating game. Play now!