BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jonatan_velarde
Lapis Lazuli | Level 10

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

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
proc reg data=have outest=parameters;
by box;
model weight=length;
run;
--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26
proc reg data=have outest=parameters;
by box;
model weight=length;
run;
--
Paige Miller
Ksharp
Super User
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 ; proc reg data=have outest=want noprint; by box; model weight=length; quit;
Ksharp
Super User
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 ; proc reg data=have outest=want noprint; by box; model weight=length; quit;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 710 views
  • 0 likes
  • 3 in conversation