BookmarkSubscribeRSS Feed
shahd
Quartz | Level 8

I need to make transformation for x7 in my model

what sas code should i write to do that 
my model should be y=x1 x2 x3 x4 x5 exp(x7) x8 x9 x10

5 REPLIES 5
PaigeMiller
Diamond | Level 26

You create a new variable in a data step that has the value exp(x7), and then in PROC REG or PROC GLM you use this new variable (and any other variables of interest) in the model.

--
Paige Miller
shahd
Quartz | Level 8
I did that but still have error
and here is my code:

trans reg data =salary
model y= x1 x2 x3 x4 x5 x6 log(x7) x8 x9 x10
run;
PaigeMiller
Diamond | Level 26

@shahd wrote:
I did that but still have error


We need to know what ERROR. Show us the SAS log. Click on the {i} icon and paste the SAS log into that window.

 

What you showed us is not code. It is missing semi-colons and the word PROC and possibly other stuff. Don't show us made up code. Show us the actual code that you used. Click on the "running man" icon and paste the actual code into that window.

 

It doesn't seem like you did anything close to what I explained in my message earlier in the thread, where I specifically said you should create a new variable in a data step.

--
Paige Miller
shahd
Quartz | Level 8
data salary;
input y x1 x2 x3 x4 x5 x6 x7 x8 x9 x10;
cards;
93302 12 15 1 240 170 1 44 5 0 21
130001 25 14 1 510 160 1 53 9 0 28
88203 20 14 0 370 170 1 56 5 0 26
74399 3 19 1 170 170 1 26 9 0 24
115301 19 12 1 520 150 1 43 7 0 27
70397 14 13 0 420 160 1 53 9 0 27
114199 18 18 1 290 170 1 43 7 0 22
72599 2 17 1 200 180 1 31 10 0 26
108597 14 13 1 560 180 1 43 7 0 23
68597 4 16 1 230 160 1 36 10 0 25
101997 8 18 1 540 150 1 39 8 1 21
101397 19 15 1 90 180 1 47 7 1 30
149403 23 16 1 560 180 1 47 7 1 23
57102 5 15 0 470 150 1 44 7 1 21
87404 3 16 1 340 190 1 33 6 1 29
131006 22 17 1 70 200 1 50 7 1 22
90301 24 14 0 160 180 1 49 6 1 26
115601 22 16 1 160 190 1 51 9 1 25
102796 13 18 1 110 180 1 33 7 1 24
141903 21 16 1 410 180 1 59 7 0 24
90899 10 13 1 370 190 1 49 7 0 26
73402 11 12 1 180 170 1 39 5 0 25
101002 12 19 1 60 200 1 39 7 0 24
85400 10 19 1 60 180 1 37 8 0 27
138303 26 17 1 110 200 1 48 9 0 24
82298 7 15 1 280 190 1 45 6 0 23
85502 7 19 1 110 180 1 29 10 0 23
75297 10 19 0 300 170 1 41 6 0 23
87501 23 14 0 220 170 1 53 6 0 27
127096 12 15 1 570 200 1 41 9 0 26
80098 6 16 1 240 180 1 33 9 0 25
90899 15 16 0 300 150 1 38 6 0 25
109601 15 18 1 260 170 1 41 8 0 22
70700 8 13 1 150 160 1 37 5 0 29
104402 18 19 0 350 160 1 38 10 0 29
71197 2 13 1 370 190 1 26 6 0 21
85400 13 14 1 150 160 1 52 10 0 21
89304 12 17 0 480 190 1 33 9 0 20
124804 21 15 1 310 180 1 52 7 0 22
42800 3 12 0 340 150 1 23 7 0 25
125004 20 16 1 520 160 1 43 6 0 28
122198 20 19 1 200 170 1 44 9 0 26
107098 20 17 0 490 160 1 40 5 0 30
60998 1 15 0 570 180 1 30 8 0 30
59802 2 17 1 70 160 1 37 6 0 23
95703 9 17 1 300 160 1 37 10 0 20
85597 11 17 0 190 160 1 41 6 0 25
88903 21 13 0 500 160 1 47 8 0 24
143000 20 20 1 390 170 1 47 6 0 21
109196 17 16 0 520 180 0 49 9 0 24
156702 24 12 1 530 200 0 60 9 0 23
65101 2 17 0 590 190 0 28 9 0 27
105905 9 13 1 560 170 0 45 8 0 22
74303 2 18 0 600 190 0 38 6 0 23
79301 13 12 0 390 170 0 48 8 0 24
106596 14 18 1 110 170 0 53 9 0 26
106404 18 13 1 190 190 0 55 10 0 25
77397 10 14 1 110 160 0 34 9 0 30
129405 21 13 1 430 190 0 59 9 0 26
82603 11 14 0 440 150 0 31 8 0 23
126096 26 15 1 210 190 0 54 7 0 27
121905 22 18 1 320 160 0 57 5 0 22
96201 3 16 1 560 180 0 38 10 0 29
128901 17 18 1 450 190 0 53 8 0 24
72200 2 16 1 410 180 0 35 6 0 24
58800 4 18 0 70 150 0 43 6 0 20
79301 8 17 1 90 190 0 34 8 0 25
96096 13 15 1 290 160 0 33 6 0 23
94902 3 18 1 530 180 0 27 8 0 24
89001 13 16 0 420 170 0 47 8 0 25
108804 25 19 0 150 200 0 49 10 0 28
95301 11 15 1 500 190 0 44 8 0 21
71197 2 17 0 430 190 0 36 8 0 20
173408 26 17 1 570 190 0 49 6 0 29
107002 20 20 1 90 150 0 59 9 0 27
99997 19 12 1 340 160 0 54 9 0 22
100700 12 13 1 440 170 0 41 8 0 27
152802 22 18 1 500 160 0 55 7 0 24
95301 13 13 0 570 180 0 37 6 0 27
77296 2 15 1 560 190 0 34 10 0 22
84601 15 14 1 160 170 0 54 9 1 25
92596 12 13 1 390 190 0 35 6 1 24
85897 13 19 0 370 200 0 40 7 1 29
79404 5 17 1 330 160 0 40 6 1 22
80098 8 17 0 560 170 0 42 7 1 25
114097 21 20 0 590 180 0 46 8 1 27
78504 5 16 1 290 200 0 28 9 1 24
87299 9 18 0 440 180 0 37 7 1 28
102899 19 15 0 480 190 0 42 10 1 28

;
run;

proc reg new1= salary;
x7=log(x7);
run;
trans reg data=new1;
model y= x1 x2 x3 x4 x5 x6 log(x7) x8 x9 x10
run;
ods rtf close;
quit;
PaigeMiller
Diamond | Level 26

So, next time I am going to be picky. Please click on the running man icon (if you hold your mouse over the icon, it says "Insert SAS Code") and then paste your code into that window.

 

You also need to show us the SAS log, which I believe if you look at it (rather than I look at it), you will see the error clearly. Click on the {i} icon and paste your code into that window.

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1369 views
  • 0 likes
  • 2 in conversation