Hi,
I have the following datasets;
Could some one tell me the right approach?
I have two tables
Table1
(no repeats by mrn)
e and i are dates.The order of these variables may vary...
like after i2 i might have e3 e4 e5 and then may come i3
and all of these may not necessarily have a date
mrn e1 i1 e2 i2
999 jun12012 june222012 aug012012 aug102012
Regards
1. Run a proc sql to merge all the data together.
2. Using a datastep create an array that is coded such as array dates(25) e1-e10 i1-15;
3. Use a do loop to go through each entry and if dates(i) between admit_date and discharge_date then new_id=visit_id.
Post some sample output please, including what happens if the e1 is between adm and discharge and i1 is not.
Also, what is stopping you from merging them? And what makes you think you need arrays if you're only looking at e1 and i1?
hi ,
we can use PROC FORMAT..!!
Regards
ALLU
proc format;
value trace_id
'29MAY2012'D - < '12JUL2012'D = '101'
'05AUG2012'D - '22AUG2012'D = '102'
'01SEP2012'D - '05SEP2012'D = '102'
;
RUN;
DATA TABLE1;
infile datalines truncover;
INPUT MRN E1 date9. i1 date9.;
format E1 trace_id.;
FORMAT i1 trace_id.;
datalines;
999 12jun201222JUN2012
;
run;
Example output?
1. Run a proc sql to merge all the data together.
2. Using a datastep create an array that is coded such as array dates(25) e1-e10 i1-15;
3. Use a do loop to go through each entry and if dates(i) between admit_date and discharge_date then new_id=visit_id.
BETWEEN is an SQL language construct. You could use it in a WHERE statement , but not in an IF statement.
The equivalent SAS syntax would by
admit_date <= dates{i} <= dis_date
Create two arrays.
But it looks like they're different sizes, so what comparison do you want when you hit i12?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.