| 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 |
| In-Reply-To: | <200309251339.h8PDd3v01281@listserv.cc.uga.edu> |
| Content-Type: | TEXT/PLAIN; charset=US-ASCII |
|---|
Ben,
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;
> run
data a;
set lib.a (keep=var1 var3 rename=(var1=var2));
run;
There is a section of the online documentation that will greatly improve
your programming abilities:SAS Language Reference: Concepts > Part 2 Data
Step Concepts.
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);
run;
Good luck,
Kevin
Kevin Viel
Department of Epidemiology
Rollins School of Public Health
Emory University
Atlanta, GA 30322
|