Date: Wed, 25 Aug 2010 11:14:45 -0700
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Rename File with SAS
Content-Type: text/plain; charset=ISO-8859-1
Ash,
In answer to your original question, the following works for me:
%let path=k:\art\;
options noxwait;
filename names pipe "dir /b &path.a_*.csv";
data files;
infile names lrecl=256 truncover;
input oldname $256.;
if upcase(scan(oldname,-1,'.'))^='CSV' then delete;
oldname=oldname;
newname = tranwrd(oldname,'A_','CC_');
oldname=catt("&path.",oldname);
call system('rename '||quote(trim(oldname))||' '||
quote(trim(newname)));
*call system('rename '||trim(oldname)||' '||
trim(newname));
run;
HTH,
Art
-----------------
On Aug 25, 11:30 am, ash007 <ramsamyash...@gmail.com> wrote:
> thanks for the info.
>
> how can I build a macro variable equal to 'DIR "C:\USERS\SUADEO
> \DESKTOP\NOUVEAU DOSSIER\" /B *.CSV';
>
> I don't know how to put the "
>
> Thanks. ash
>
> DATA _NULL_;
> FICHIERPIPE = CAT(
> "'",
> "DIR ",
> ???, "&__LOCALISATION.", ???
> " /B",
> " *.",
> "&__TYPE",
> "'"
> );
>
> CALL SYMPUT('__FICHIERPIPE',TRIM(FICHIERPIPE));
> RUN; %PUT &__FICHIERPIPE.;
>
> FILENAME NAMES PIPE "&__FICHIERPIPE.";
|