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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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