|Date: ||Thu, 25 Sep 2003 10:06:34 -0400|
|Reply-To: ||Kevin Roland Viel <kviel@EMORY.EDU>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Kevin Roland Viel <kviel@EMORY.EDU>|
|Subject: ||Re: Data Step Question|
|Content-Type: ||TEXT/PLAIN; charset=US-ASCII|
If you are comfortable using PROC SQL, then by all means use it. You
can improve upon the following though.
> data a;
> set lib.a;run;
> data a (rename=(var1=var2));
> set a;run;
> data a;
> set a;
> keep var2 var3;
set lib.a (keep=var1 var3 rename=(var1=var2));
There is a section of the online documentation that will greatly improve
your programming abilities:SAS Language Reference: Concepts > Part 2 Data
Basically, you have tripled the number of data steps you need.
Additionally, you have pulled through potentially many more variables than
you might need.
However, there may not be a need to even do this. The data set options
(KEEP, RENAME, and even WHERE) are valid everywhere, even the procedures.
proc print data=lib.a (keep=var1 var3 rename=(var1=var2);
Department of Epidemiology
Rollins School of Public Health
Atlanta, GA 30322