I am new to SAS. I have 12(Monthly data) data sets in a folder. Names of data sets are:
201401
201402
201403
...
201411
201412
Each data contain 10 Variables. Variable names are same for all data.
I want only 3 Variables among 10 and rename data by new_201401
and so on.
I am trying it manually by using Keep Var1 Var2 Var3;
but is there any easy way or macro so we can make it fast? Thanks in advance.
You can rename them using the following macro (note: the
%if
conditions are just split out to include a leading0
for single digit months):You can then then for example pass these values into
proc datasets
for whatever years you need:I think this will do the trick: