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
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: