12-05-2015 04:42 PM
Hi there my SAS friends:
I have a question about solving an function using 2 independent data sets, this because in one of them i have my dependent variable and in the other my independent variables.
So, here is what i have:
I have accomplished to generate the mean diference between 2 data sets, and further this diference i obtained 3 values a0 b0 and b1, like that:
merge mean1 mean2;
diff = mean_var_interest1 - mean_var_interest2;
a0 = (mean_var_interest1- mean_var_interest2)/30;
b0 = log(a0/mean_var_interest2);
b1 = b0/10;
The next step, to increase the efficience of the solution; i need to use a0 b0 and b1 into this function:
proc nlin data=any_other_dataset plots=all method=marquardt;
parms a0 = a0 b0 = b0 b1 = b1;
output out=est_ind1 p=pred r=resid parms=a0 b0 b1;
I have to write the specifications of the function, being: response and observation that belong to the dataset called 'any_other_dataset'
Thank you very much for your suggestions and help.
12-06-2015 09:44 AM - edited 12-06-2015 10:54 AM
Thank you for your answer but unfortunaly didn't work, in log file appears:
12-06-2015 01:31 PM
Interesting. I guess you want the WHERE condition to apply to the data from Sem_data_Negat. Try moving the where statement BEFORE the PARMS statement.
12-07-2015 09:04 AM
You need a BY on your MERGE. This should be the variable that matches between the data sets (ID number or whatever). If no variable matches between data sets then any results you get will be nonsense.
12-07-2015 11:14 AM
@plf515, it is not necessarily good practice, but MERGE without BY does exist. It is called One-to-One merging.
It can be convenient for combining single observation datasets (I know, there are other methods).
12-07-2015 01:44 PM
@PGStats Yes, I know it exists. But .... I think I heard this in a SGF talk long ago:
If you merge without a by
You'll get strange results and won't know why
12-07-2015 02:14 PM - edited 12-07-2015 02:15 PM
I didn't attend that SGF talk, so I don't know the details, but that statement seems to incite unnecessary worry. I regularly use MERGE without a BY statement to horizontally concatenate data that I then use to use in creating ODS graphics. (See the end of this article for a discussion.) I've never had a problem.
Philosophically, you have to accept that the first observation in data set 'A' might have nothing to do with the first observation in data set 'B'. Of course, I wouldn't do a statistical analysis of the combined data unless I knew that the observations lined up.
Perhaps a more fair poem would be:
To horizontally concatenate,
MERGE without BY is really great.
But if the variables don't relate,
a statistical analysis is tempting fate.