Some examples of policies (note: excerpts are all very brief, I've included them mostly just to indicate these journals all have policies and that none require all data to be shared, more detail is available at their websites; I included a bit more from The Lancet since it was mentioned in the OP; I made some formatting changes to display better on StackExchange):
For reports of randomized clinical trials, authors are required to provide a Data Sharing Statement to indicate if data will be shared or not.
The International Committee of Medical Journal Editors (ICMJE) and, therefore, NEJM require investigators to submit a data-sharing statement (2018) and register a data-sharing plan when registering a trial (2019). NEJM has not yet formulated a policy on which types of data-sharing plans are acceptable.
BMJ journals have three tiers of data sharing, marked by journal here.
As a general statement, they write:
We encourage you to make available as much of the underlying data from your article as possible (without compromising participant privacy), but at least the minimum data required to reproduce the results presented in the associated article.
And The Lancet's own policy:
From July 1, 2018, all submitted reports of clinical trials must
contain a data sharing statement, to be included at the end of the
manuscript. Data sharing statements must indicate:
• Whether data collected for the study, including individual
participant data and a data dictionary defining each field in the set,
will be made available to others (“undecided” is not an acceptable
• What data will be made available (deidentified participant data,
participant data with identifiers, data dictionary, or other specified
• Whether additional, related documents will be available (eg, study
protocol, statistical analysis plan, informed consent form);
• When these data will be available (beginning and end date, or “with
publication”, as applicable);
• Where the data will be made available (including complete URLs or
email addresses if relevant);
• By what access criteria data will be shared (including with whom,
for what types of analyses, by what mechanism – eg, with or without
investigator support, after approval of a proposal, with a signed data
access agreement - or any additional restrictions).
Medical journals tend to encourage but not require sharing of data, and it is now standard in most major journals to require some sort of statement about data, either mentioning how data can be obtained or why data cannot be shared. Peer reviewers can also request further analyses or less abstracted data during the peer review process.
Raw data in particular are quite an issue for medical research, because aspects of the data involve the private and often legally protected health information of individuals. Journal policies avoid conflict with these protections or else important research cannot be published there.
Even anonymized data can potentially be revealing and may not be as anonymous as it seems.
Overall, there is a move towards more open data policies, and you'll see from these examples (both quoted and in the linked pages) that they refer to updates in just the past few years.
Rocher, L., Hendrickx, J. M., & De Montjoye, Y. A. (2019). Estimating the success of re-identifications in incomplete datasets using generative models. Nature communications, 10(1), 1-9.