05-24-2016 06:27 AM
I have two sas datasets which looks as below
id A B C D E
id B A C E D
How can I combine these two datasets, here my variables are not in same as you can see above.
I would like to combine these two into one datset.
05-24-2016 06:36 AM
As long as the columns have the same names, their order in the dataset is irrelevant.
05-24-2016 06:44 AM
Irrespective of position, when the PDV executes, it creates in memory one variable for each one found in the contributing tables, if the same appears twice then you will get errors. There are several methods to get what you want, but they all require some sort of renaming or re-populating to variables with a different name. So say A is your linking variable you could do:
data want; set have1 have2 (rename=(b=b1 c=c1 d=d1 e=e1)); by a; run;
05-24-2016 07:59 AM
You can rename to any valid SAS variable name
- maximum of 32 characters
- must start with a letter or underline
- can contain letters, underlines and numbers