Click on the Comments to view the Answers

Wednesday, January 27, 2010

Base 53

The contents of two SAS data sets named EMPLOYEE and SALARY are listed below:


EMPLOYEE SALARY
Bruce 30
Dan 35
NAME AGE NAME SALARY

Bruce 40000
Bruce 35000
Dan 37000
Dan  .

data emplsal;
merge employee (in=ine) salary(in=ins);
by name;
if ine and ins;
run;

How many observation are in EMPLSAL dataset
A. 4
B. 3
c. 2
D. 1

7 comments:

SASGuru said...

Answer A
This is an example of one-many relationship merge.
The resultant dataset will have

Name age salary

Bruce 30 40000
Bruce 30 35000
Dan 35 37000
Dan 35 .

siva said...

Answer A

Pooja said...

Would it have made a difference if the order of merge was changed? i.e -
data emplsal;
merge salary(in=ins) employee (in=ine);
by name;
if ine and ins;
run;

Thanks!

Unknown said...

pooja.. nope

CompleteExamCollection said...

For latest and updated SAS certification dumps in PDF format contact us at completeexamcollection@gmail.com.
Refer our blog for more details
http://completeexamcollection.blogspot.in/2015/12/sas-certification-dumps.html

Unknown said...

Can you guys explain about (in=ine)?

Unknown said...

hi Unknown run the following code

/* Merge example */

data work.EMPLOYEE_AGE;
input name $ age;
datalines;
Bruce 30
Dan 35
;
run;

data work.employee_salary;
input name $ salary;
datalines;
Bruce 40000
Bruce 35000
Dan 37000
Dan .
;
run;


data work.emplsal;
merge work.employee_age (in=ine) work.employee_salary(in=ins);
by name;
if ine and ins;
run;

proc print data=work.emplsal;
run;

this will show the results. To explain the (IN=INS) and (IN=INE) are two temporary variable which are stored in the PDV but not in the resultant output dataset work.emplsal;

These variables are set to 0 or 1 depending on weather a row from either data set contributed anything to the merged row.

the statement

if ine and ins; /* means a shortened version of (if INE=1 and INS=1)
this means each data set needs to contribute something to the merged output so the results output in this case are

Obs name age salary
1 Bruce 30 40000
2 Bruce 30 35000
3 Dan 35 37000
4 Dan 35 .

the last result observation 4 is interesting cause at first site it looks like it is not contributing anything i.e a missing value for salary but none the less contributes or shows a missing value

Post a Comment



Technology Top Blogs On our way to 1,000,000 rss feeds - millionrss.com Hihera.com Blog Directory - OnToplist.com blogarama - the blog directory Blog Directory
Disclaimer

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Other brand and product names are trademarks of their respective companies.

This blog is not responsible for any kind of copyright violation. This blog just collects the links hosted or posted by other servers/people/search engines.The creator of this page or the ISP(s) hosting any content on this site take no responsibility for the way you use the information provided on this site.If anybody has any copyright claim on it and doesn’t wish the information provided to be shown on our site, please do respond to this email. We shall remove them off immediately. Any inconvenience is regretted. Please do mention your exact grievance/problems with respect to certain third party links. We assure you that appropriate action will be taken off. Thank you