I have one file that contains parameter estimates (36 different values) [this is the screenshot called ‘merged estimates’. This file does not contain any patient IDs, demographics, etc.
I have a second file that contains my study sample sorted by patient ID (9,965 participants). I would like to merge both files so that each participant has the same sequence of 36 values.
My current output only has the sequence of 36 values for the 1st observation [second screenshot called ‘merged dataset’].
Thank you so much for your suggestions.
This is the code I was trying to no avail.
data createBAestimate ;
merge V12 mergeestimate ;
do i = 1 to 9965 ;
output ;
end;
run;
You can't merge in one row to a full data set this way.
This will work for you though:
data createBAestimate;
set V12;
if _n_ =1 then set mergeestimate;
run;
Without a BY statement, the merge operates by position, on a line by line merge so the first rows are merged and then nothing as you've seen.
FYI if you're trying to score data, look into PROC PLM.
@talktorob wrote:
I have one file that contains parameter estimates (36 different values) [this is the screenshot called ‘merged estimates’. This file does not contain any patient IDs, demographics, etc.
I have a second file that contains my study sample sorted by patient ID (9,965 participants). I would like to merge both files so that each participant has the same sequence of 36 values.
My current output only has the sequence of 36 values for the 1st observation [second screenshot called ‘merged dataset’].
Thank you so much for your suggestions.
This is the code I was trying to no avail.
data createBAestimate ;
merge V12 mergeestimate ;
do i = 1 to 9965 ;
output ;
end;
run;
You can't merge in one row to a full data set this way.
This will work for you though:
data createBAestimate;
set V12;
if _n_ =1 then set mergeestimate;
run;
Without a BY statement, the merge operates by position, on a line by line merge so the first rows are merged and then nothing as you've seen.
FYI if you're trying to score data, look into PROC PLM.
@talktorob wrote:
I have one file that contains parameter estimates (36 different values) [this is the screenshot called ‘merged estimates’. This file does not contain any patient IDs, demographics, etc.
I have a second file that contains my study sample sorted by patient ID (9,965 participants). I would like to merge both files so that each participant has the same sequence of 36 values.
My current output only has the sequence of 36 values for the 1st observation [second screenshot called ‘merged dataset’].
Thank you so much for your suggestions.
This is the code I was trying to no avail.
data createBAestimate ;
merge V12 mergeestimate ;
do i = 1 to 9965 ;
output ;
end;
run;
Hi Reeza,
Thank you so much for your explanation. Your code worked! Much appreciated.
Regards,
Robert
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.