02-28-2013 06:48 PM
So lets say if there are six excel files all containing similar variables names and their own observations, ie. in one excel file the variable name might be Payor Name, Name ID, Assigned Code, where the other excel might say Original Payor Name, Original ID, Proc Code and the third excel might say Original Payer Name, Original Name ID, Code. All have similar variable names that represents the same thing.
And now, I've successfully imported them into SAS and I want to rename the variable names so that they all have a standardized name, i.e. Payor Name, Payor ID, Code and because I am working with six excel files, I thought that it may be conveninet to write a macro that renames all the variable names, and this is where I am currently stuck on...
I'm new to SAS and understand the basics of macro and rename but combining them is my problem even though I feel like it is do-able. please help!
02-28-2013 08:36 PM
I doubt that a macro would add much value to this situation. Unless it was an Excel macro that you gave out to the people supplying you with the data so that the files would be consistently formatted.
Just type the code into your editor and copy and paste it five more times and adjust for the differences.
one (rename = ('Payor Name'n = payor "Name ID"n = name "Assigned Code"n = code ))
two (rename = ('Original Payor Name'n = payor "Original ID"n = name "Proc Code"n = code ))
03-01-2013 11:37 AM
If the data was all in the same order then you could use PROC SQL Union all or Insert into and the names would be taken from the first file.
create table want as
select * from (
select * from table1
select * from table2) a;