BookmarkSubscribeRSS Feed
jonatan_velarde
Pyrite | Level 9

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.

7 REPLIES 7
PGStats
Opal | Level 21

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

 

parms / pdata=dif_want;

PG
jonatan_velarde
Pyrite | Level 9

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
PGStats
Opal | Level 21

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
plf515
Lapis Lazuli | Level 10

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.

PGStats
Opal | Level 21

@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
plf515
Lapis Lazuli | Level 10

@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

Rick_SAS
SAS Super FREQ

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.

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1808 views
  • 1 like
  • 4 in conversation