I need help in merging two different datasets. I am merging
by date and I want to propagate observations from one
dataset to the corresponding dates. One dataset has a
unique date for each day of the month, while the other
dataset has same date for different patient visits. For
example I want to spread an observation on the 31DEC2008
from one dataset to several observations with the same date
on a second dataset for all the patients who visited on
that date. I have tried to merge the two and the result is
not what I wanted. Instead I get a dataset whereby all the
dates have missing values where observations from the first
datset should have spread.



I need help in merging two different datasets. I am merging by date and I want to propagate observ..

Answer / kumaraswamy maduri

data new;
date1="31Dec2008"d;
run;

data new1;
input date1 date9. subj;
cards;
31dec2008 1
30dec2008 1
30dec2008 2
31dec2008 2
;
run;

proc sort;by date1;run;

data comp;
merge new(in=x) new1;
by date1;
if x;
run;

I have used the above code. I got perfect results.

Please correct me if I misunderstood your question.

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More SAS Interview Questions

What is the use of stop statement?

0 Answers  


How many ways to overcome a missing values???

0 Answers   HSBC,


Hi , which book should i refer to for preaparing SAS statistical Exam. Searched a lot on books but still did n't find relevant books

2 Answers  


which stats created by proc means that are not created by proc summary or vice versa?

2 Answers   GSK,


Are you sensitive to code walk-throughs peer review or QC review?

0 Answers   Quintiles,






How do you debug and test your SAS programs? What can you learn from the SAS log when debugging? How do you test for missing values? How would you create multiple observations from a single observation? What are some good SAS programming practices for processing very large data sets? Briefly describe 5 ways to do a "table lookup" in SAS. Why is SAS considered self-documenting? Are you sensitive to code walk-throughs, peer review, or QC review? What other SAS features do you use for error trapping and data validation? How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?

2 Answers  


Below is the table. Required to be output should be the highest number of each student_id. Example. Student_id Subject Marks 1 Hindi 86 2 Hindi 70 3 English 80 . Calculate sum and average marks for each group of student_id Example. Student_id Subject Marks Total Marks Average 1 English 40 181 60.33333 2 English 67 196 65.33333 3 English 80 160 53.33333 PLEASE PROVIDE THE CODE OF ABOVE PROBLEMS

1 Answers   Accenture, HSBC,


What data sets do you need to produce the report?

2 Answers   Novartis,


explain the main difference between the nodup and nodupkey options? : Sas-administrator

0 Answers  


Have you used macros? For what purpose you have used? : sas-macro

0 Answers  


In SAS explain which statement does not perform automatic conversions in comparisons?

0 Answers  


What is PROC in SAS?

0 Answers  


Categories