I have 3 tables that I merged and it creates 3 separate rows because of various column titles, but I want it to create 1 row per strata. I attached what it looks like when I do the merge. I want it all on 1 row by the strata
Replace "set" with "merge".
Is example_table_date exactly like how your data is in SAS? Why do you post under different names?
Yes it is. Because I am on my work computer right now and that is how they set up my desktop for the log in. The other is another log in from when I had another job but my current company will not let me use that. I have tried to log in on my home computer with this log in, but it is blocked. I guess employer related.
How did you merge them? show your code please.
data pos_aggregates;
set pos_tinofc pos_tinop pos_tinip;
by strata;
run;
1 table has the info for office, 1 table has the info for outpatient, 1 table has info for inpatient. I need to report on all the data but I am trying to figure out how to get it in 1 row for it all. I tried creating a table and appending. Did same thing as above code. Tried joins but it dropped records.
Replace "set" with "merge".
The SET statement INTERLEAVES observations, so the resulting data set has N1 (n records in pos_tinofc) + N2 (pos_tinop) + N3 (pos_tinip) records.
Now if the only variable in common in the 3 data sets is STRATA, then the MERGE statement will work (I assume as data set has no more than one record per stratum).
data want;
merge pos_tinofc pos_tinop pos_tinip;
by strata;
run;
If your 3 data sets have other variables in common, then let us know.
regards,
Mark
Wish they would have the option in SAS forum to give correct answer to more than 1 person. I am an idiot. You know I knew this and for some reason I was just having one of those days. Thanks
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.