turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Using data from 2 independent data sets

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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:

data dif_want;

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;

run;

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**;

model response=a0*exp(exp(b0)*(exp(b1*observation)-1)/b1

id Sample;

output out=est_ind1 p=pred r=resid parms=a0 b0 b1;

run;

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to jonatan_velarde

12-05-2015 06:16 PM

If you want the values from dif_want as starting values for the nonlinear regression. Use

parms / pdata=dif_want;

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

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:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

55

56 proc nlin data=Sem_data_Negat plots=all method=marquardt;

57 parms / pdata=dif_want;

58 where age_in_days >= 0 and age_in_days <= 40;

ERROR: Variable age_in_days is not on file WORK.DIF_WANT.

59 model weight_in_Kilograms=a0*exp(exp(b0)*(exp(b1*age_in_days)-1)/b1);

60 id Animal;

61 output out=est_ind1 p=Peso_Predito1 r=resid parms=a0 b0 b1;

thanks

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to jonatan_velarde

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.

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to jonatan_velarde

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to plf515

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.

http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001318478.htm

It can be convenient for combining single observation datasets (I know, there are other methods).

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to plf515

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.*