Date: Sat, 23 Oct 2010 11:04:47 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: What is difference between using rename in data or set statement?
I asked this question in an earlier thread, but think it may not have been
noticed. In the following example, on a manipulated file, using a rename
works as an option in a data statement, but not when used in a set
statement.
Can anyone explain why?
%let myfolder=k:\art;
libname myfolder "&myfolder.";
/*Create a test file*/
data myfolder.filein;
set sashelp.class (rename=(sex=sez));
run;
data _NULL_;
FILE "&myfolder.\fileout.sas7bdat" RECFM=N;
infile "&myfolder.\filein.sas7bdat" RECFM=N ;
input VAR1 $CHAR1. @;
IF VAR1 eq '7A'X then do;
var1='6F'X;
end;
PUT VAR1 $CHAR1. ;
run;
/*The following doesn't work*/
data myfolder.fileout;
set myfolder.fileout (rename=(seo=sex));
run;
/*The following works*/
data myfolder.fileout (rename=(seo=sex));
set myfolder.fileout;
run;
Just curious,
Art