Good morning SAS friends:
I have this data set:
data have;
input box length weight ;
cards;
1 8.1 6.3
1 9.1 9.6
1 10.2 11.6
1 11.9 18.5
1 12.2 26.2
1 13.8 36.1
1 14.8 40.1
1 15.7 47.3
2 16.6 65.6
2 17.7 69.4
2 18.7 76.4
2 19 82.5
2 20.6 106.6
2 21.9 119.8
2 22.9 169.2
2 23.5 173.3
;
using this data set, i apply two regressions, one for box 1 and other for box 2, resulting some tables, the first one for ANOVA and the second one indicating the estimates of the variables, the last of the is the main reason to note:
For box 1:
Parameter Estimates | |||||
---|---|---|---|---|---|
Variable | DF | Parameter Estimate |
Standard Error |
t Value | Pr > |t| |
Intercept | 1 | -42.10680 | 5.35822 | -7.86 | 0.0002 |
length | 1 | 5.55902 | 0.43770 | 12.70 | <.0001 |
and for Box 2:
Parameter Estimates | |||||
---|---|---|---|---|---|
Variable | DF | Parameter Estimate |
Standard Error |
t Value | Pr > |t| |
Intercept | 1 | -224.06587 | 41.01922 | -5.46 | 0.0016 |
length | 1 | 16.50296 | 2.02574 | 8.15 | 0.0002 |
The main objective of this problem is create a new data set containing both the intercept and slope for each box, like this:
Box | intercept | length |
1 | -42.1068 | 5.55902 |
2 | -224.06587 | 16.50296 |
Thanks in advance
proc reg data=have outest=parameters;
by box;
model weight=length;
run;
proc reg data=have outest=parameters;
by box;
model weight=length;
run;
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: