How would you combine 3 or more tables with different
structures?
Answers were Sorted based on User's Feedback
Answer / piyushjk
I would use Merge statement to combine theree tables (SAS
Datasets). First you have to sort the datasets by common
variable. provide the condition with in merge statement.
For e.g. Three datasets are A, B, C and common var is SSN,
then
DATA Together;
Merge A (IN=A)
B (IN=B)
C (IN=C);
By SSN; Run;
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / nandu
sort all datasets before going to merge
data abc ;
merge aa (in=a) bb (in=b) cc(in=c) ;
by empid /*by variable*/
if a or b or c;/*based on your requirement*/
run;
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / akshay surya
Yes we can use joins and Merge statements as well. But in
bothe the scenarios, a commmon variable should be there for
all tables(can have different structures). And also one
should take care when tables contains too many duplicate
values.(may be eliminating the duplicate values is probably
the best way to get the intended result, otherwise output
result will be the reuslt of a cartesian product).
| Is This Answer Correct ? | 5 Yes | 3 No |
Answer / venu
join concept use to combine 3 or more tables with different
structures
| Is This Answer Correct ? | 3 Yes | 3 No |
I think sort them with common variables and use merge statement.
No matter if they are of different structures, only that the result will have missing values for nonmatching records. If you wanna avoid this use In() operator OR
use proc sql with Join clause which will just pick matching records.
| Is This Answer Correct ? | 0 Yes | 0 No |
Name validation tools used in SAS
What are types of transport files?
2 Answers PRA Health Sciences, Quintiles,
what is _error_?
2 Answers Axis Bank, Cognizant, JPMorgan Chase,
How would you identify a macro variable? : sas-macro
what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming
What are the data types does SAS contain?
How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?
how will you locate the sas platform applications? : Sas-bi
How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?
There is a field containing a date. It needs to be displayed in the format “ddmonyy” if it’s before 1975,”dd mon ccyy” if it’s after 1985, and as ‘disco years’ if its between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT.
what is the diff. b/w proc means and proc summary?
What is the difference Using & and && in the macro variables