Hi All,
I have to calculate baseline for two different visits for which I used this step
proc tabulate data= data2a out=baseline (drop=_:);
where visit in('Period1' 'Period2');
class tests visit;
var aval;
table tests*visit*aval* ( mean);
run;
My dataset baseline would be something like this:
Tests Visit Aval_Mean
ABC Period1 12345
ABC Period2 67890
DEF Period1 56789
DEF Period2 93489
And I have the AVAL_MEAN value for two different visits , so now when I merge this baseline data with post baseline visits by tests the AVAL_MEAN from period1 Values are getting overwritten by period2 values for postbaseline visits something like this:
Tests Visit Aval_Mean
ABC Period1 12345
ABC Period1_day3 67890
ABC Period1_day4 67890
ABC Period2 67890
ABC Period2_day3 67890
ABC Period2_day4 67890
but I dont need this and I need something like this:
Tests Visit Aval_Mean
ABC Period1 12345
ABC Period1_day3 12345
ABC Period1_day4 12345
ABC Period2 67890
ABC Period2_day3 67890
ABC Period2_day4 67890
Can someone please suggest me a workaround for this...Any help will be greatly appreciated...Thanks
Show how you are combining the data sets.
It sounds like you are using merge and have a same named variable in both sets. The order of the sets in merge determines which value is kept with same named variables. Perhaps you need to rename a variable. But without a better example of both data sets it isn't clear.
I am merging them by tests..
data data4;
merge baseline data3;
by tests ;
run;
If I use visit in the by statement then I am getting the aval_mean value just for the the period1 and period2 visits and missing for postbaseline visits...
And also I would like to add something here...which I missed the visits for baseline are 'Period1_day-1' 'Period2_day-2' and not just Period1' 'Period2' .
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 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.