BookmarkSubscribeRSS Feed
amartinez401
Calcite | Level 5

options linesize=80;

data;

input ENGINE $ SHAFTS RPM CPRATIO INLET-TEMP EXH-TEMP AIRFLOW POWER HEATRATE;

if ENGINE='Traditional' then dummy=1; if ENGINE= ‘Advanced’ then dummy=2; else dummy=0;

RPMCPRATIO=RPM*CPRATIO;

RPMRPM=RPM*RPM;

CPRCPR=CPRATIO*CPRATIO;

datalines;

Traditional 1 27245 9.2 1134 602 7 1630 14622

Traditional 1 14000 12.2 950 446 15 2726 13196

Traditional 1 17384 14.8 1149 537 20 5247 11948

Traditional 1 11085 11.8 1024 478 27 6726 11289

Traditional 1 14045 13.2 1149 553 29 7726 11964

Traditional 1 6211 15.7 1172 517 176 52600 10526

Traditional 1 6210 17.4 1177 510 193 57500 10387

Traditional 1 3600 13.5 1146 503 315 89600 10592

Traditional 1 3000 15.1 1146 524 375 113700 10460

Traditional 1 3000 15.0 1171 525 514 164300 10086

Traditional 1 18000 12.7 1038 525 11 2000 14628

Traditional 1 11140 9.1 1038 523 25 5223 13396

Traditional 1 16630 15.0 1232 571 19 5500 11726

Traditional 2 7900 15.6 1077 482 47 11700 11252

Traditional 1 5100 10.0 963 485 123 26555 12449

Traditional 1 5160 12.3 1135 542 144 42170 11030

Traditional 1 3600 12.6 1113 534 295 86650 10787

Traditional 1 3000 12.3 1124 541 410 124700 10603

Traditional 1 3000 14.2 1204 553 515 172985 10144

Traditional 1 14000 15.9 1177 521 27 6930 11674

Traditional 1 3660 14.6 1135 526 56 14838 11510

Traditional 1 5400 15.3 1149 514 172 49500 10946

Traditional 1 3600 14.2 1141 526 362 109370 10508

Traditional 1 3600 11.0 1149 544 354 108719 10604

Traditional 1 3600 14.2 1177 525 378 120500 10270

Traditional 1 3000 14.2 1116 511 448 132220 10529

Traditional 1 3000 11.1 1149 537 500 157010 10360

Traditional 1 22516 6.6 899 512 7 1210 14796

Traditional 1 14950 9.7 916 444 19 3515 12913

Traditional 1 14950 10.7 1054 517 19 4600 12270

Traditional 1 14950 12.0 1093 513 22 5500 11842

Traditional 1 14950 15.0 1121 490 27 7520 10656

Traditional 2 8568 16.2 1066 464 39 9286 11360

Traditional 2 8568 17.6 1104 487 42 10685 11136

Traditional 1 11220 15.8 1121 493 49 13500 10814

Traditional 1 4473 8.9 960 517 158 32776 13523

Traditional 1 3600 12.4 1079 515 311 81600 11289

Traditional 1 3000 12.5 1041 490 400 100500 11183

Traditional 2 10400 15.0 1057 479 26 6844 10951

Advanced 1 6600 20.0 1288 546 120 43000 9722

Advanced 1 5100 14.8 1288 590 204 70905 10481

Advanced 1 3600 15.5 1327 599 448 174000 9812

Advanced 1 3600 18.5 1371 626 445 186600 9669

Advanced 1 3000 14.6 1327 599 648 259670 9643

Advanced 1 3000 23.2 1427 566 685 282000 9115

Advanced 1 3000 23.2 1427 621 685 331000 9115

Advanced 1 7280 14.3 1271 556 49 13680 11588

Advanced 1 7280 14.6 1271 556 88 27010 10888

Advanced 1 3600 16.0 1343 607 453 185400 9738

Advanced 1 3600 20.0 1427 596 567 254000 9295

Advanced 1 3000 17.0 1343 586 651 270300 9421

Advanced 1 3000 21.0 1427 587 737 334000 9105

Advanced 1 5400 16.1 1288 531 188 62300 10233

Advanced 1 5400 16.2 1310 589 187 68000 10186

Advanced 1 3600 16.0 1288 551 425 153600 9918

Advanced 1 3600 16.9 1343 577 440 182000 9209

Advanced 1 3600 15.0 1349 590 450 186500 9532

Advanced 1 3000 14.0 1260 585 510 189000 9933

Advanced 1 3600 19.2 1427 594 550 253000 9152

Advanced 1 3000 17.0 1316 584 642 265540 9295

Aeroderiv 2 33000 6.9 888 513 3 486 16243

Aeroderiv 2 30000 8.5 1004 561 4 806 14628

Aeroderiv 2 18910 14.0 1066 532 8 1845 12766

Aeroderiv 3 3600 35.0 1288 448 152 57930 8714

Aeroderiv 3 3600 20.0 1160 456 84 25600 9469

Aeroderiv 2 16000 10.6 1232 560 14 3815 11948

Aeroderiv 1 14600 13.4 1077 536 20 4942 12414

proc reg;

model HEATRATE = RPM CPRATIO RPMCPRATIO RPMRPM CPRCPR/;

output out=new  student=stud cookd=cook h=lever r=resid;

proc print;

proc univariate normal plot;

var resid;

run;

Thank you!!

6 REPLIES 6
Jagadishkatam
Amethyst | Level 16

Hi

Your code is absolutely perfect except the highlighted portion, the quotes in the highlighted portion are not right, check the quotes of Advanced with that of

Traditional, there is a difference. For Traditional you have used single quotes, however for Advanced the quotes used are not single quotes. Due to this no dataset is created and in the final you got that error


if ENGINE='Traditional' then dummy=1; if ENGINE= ‘Advanced’ then dummy=2; else dummy=0;

Please find the corrected code with the right quotes

if ENGINE='Traditional' then dummy=1; if ENGINE= 'Advanced' then dummy=2; else dummy=0;

Thanks,

Jagadish

Thanks,
Jag
amartinez401
Calcite | Level 5

I just tried again without those correct quotes and am still getting

5958  proc univariate normal plot;

5959  var resid;

ERROR: Variable RESID not found.

5960  run;

in my log Smiley Sad did it run for you?

Jagadishkatam
Amethyst | Level 16

Yes it did run well for me without any errors in log

Please try the below code

options linesize=80;

data;

input ENGINE $ SHAFTS RPM CPRATIO INLET_TEMP EXH_TEMP AIRFLOW POWER HEATRATE;

if ENGINE='Traditional' then dummy=1; if ENGINE= 'Advanced' then dummy=2; else dummy=0;

RPMCPRATIO=RPM*CPRATIO;

RPMRPM=RPM*RPM;

CPRCPR=CPRATIO*CPRATIO;

datalines;

Traditional 1 27245 9.2 1134 602 7 1630 14622

Traditional 1 14000 12.2 950 446 15 2726 13196

Traditional 1 17384 14.8 1149 537 20 5247 11948

Traditional 1 11085 11.8 1024 478 27 6726 11289

Traditional 1 14045 13.2 1149 553 29 7726 11964

Traditional 1 6211 15.7 1172 517 176 52600 10526

Traditional 1 6210 17.4 1177 510 193 57500 10387

Traditional 1 3600 13.5 1146 503 315 89600 10592

Traditional 1 3000 15.1 1146 524 375 113700 10460

Traditional 1 3000 15.0 1171 525 514 164300 10086

Traditional 1 18000 12.7 1038 525 11 2000 14628

Traditional 1 11140 9.1 1038 523 25 5223 13396

Traditional 1 16630 15.0 1232 571 19 5500 11726

Traditional 2 7900 15.6 1077 482 47 11700 11252

Traditional 1 5100 10.0 963 485 123 26555 12449

Traditional 1 5160 12.3 1135 542 144 42170 11030

Traditional 1 3600 12.6 1113 534 295 86650 10787

Traditional 1 3000 12.3 1124 541 410 124700 10603

Traditional 1 3000 14.2 1204 553 515 172985 10144

Traditional 1 14000 15.9 1177 521 27 6930 11674

Traditional 1 3660 14.6 1135 526 56 14838 11510

Traditional 1 5400 15.3 1149 514 172 49500 10946

Traditional 1 3600 14.2 1141 526 362 109370 10508

Traditional 1 3600 11.0 1149 544 354 108719 10604

Traditional 1 3600 14.2 1177 525 378 120500 10270

Traditional 1 3000 14.2 1116 511 448 132220 10529

Traditional 1 3000 11.1 1149 537 500 157010 10360

Traditional 1 22516 6.6 899 512 7 1210 14796

Traditional 1 14950 9.7 916 444 19 3515 12913

Traditional 1 14950 10.7 1054 517 19 4600 12270

Traditional 1 14950 12.0 1093 513 22 5500 11842

Traditional 1 14950 15.0 1121 490 27 7520 10656

Traditional 2 8568 16.2 1066 464 39 9286 11360

Traditional 2 8568 17.6 1104 487 42 10685 11136

Traditional 1 11220 15.8 1121 493 49 13500 10814

Traditional 1 4473 8.9 960 517 158 32776 13523

Traditional 1 3600 12.4 1079 515 311 81600 11289

Traditional 1 3000 12.5 1041 490 400 100500 11183

Traditional 2 10400 15.0 1057 479 26 6844 10951

Advanced 1 6600 20.0 1288 546 120 43000 9722

Advanced 1 5100 14.8 1288 590 204 70905 10481

Advanced 1 3600 15.5 1327 599 448 174000 9812

Advanced 1 3600 18.5 1371 626 445 186600 9669

Advanced 1 3000 14.6 1327 599 648 259670 9643

Advanced 1 3000 23.2 1427 566 685 282000 9115

Advanced 1 3000 23.2 1427 621 685 331000 9115

Advanced 1 7280 14.3 1271 556 49 13680 11588

Advanced 1 7280 14.6 1271 556 88 27010 10888

Advanced 1 3600 16.0 1343 607 453 185400 9738

Advanced 1 3600 20.0 1427 596 567 254000 9295

Advanced 1 3000 17.0 1343 586 651 270300 9421

Advanced 1 3000 21.0 1427 587 737 334000 9105

Advanced 1 5400 16.1 1288 531 188 62300 10233

Advanced 1 5400 16.2 1310 589 187 68000 10186

Advanced 1 3600 16.0 1288 551 425 153600 9918

Advanced 1 3600 16.9 1343 577 440 182000 9209

Advanced 1 3600 15.0 1349 590 450 186500 9532

Advanced 1 3000 14.0 1260 585 510 189000 9933

Advanced 1 3600 19.2 1427 594 550 253000 9152

Advanced 1 3000 17.0 1316 584 642 265540 9295

Aeroderiv 2 33000 6.9 888 513 3 486 16243

Aeroderiv 2 30000 8.5 1004 561 4 806 14628

Aeroderiv 2 18910 14.0 1066 532 8 1845 12766

Aeroderiv 3 3600 35.0 1288 448 152 57930 8714

Aeroderiv 3 3600 20.0 1160 456 84 25600 9469

Aeroderiv 2 16000 10.6 1232 560 14 3815 11948

Aeroderiv 1 14600 13.4 1077 536 20 4942 12414

proc reg;

model HEATRATE = RPM CPRATIO RPMCPRATIO RPMRPM CPRCPR/;

output out=new  student=stud cookd=cook h=lever r=resid;

proc print;

proc univariate normal plot;

var resid;

run;

Thanks,

Jagadish

Thanks,
Jag
amartinez401
Calcite | Level 5

thank you so much!

I have a few more questions about this problem was wondering if I can ask you in a message?

DBailey
Lapis Lazuli | Level 10

I'm not sure this line is doing what you think it is:

if ENGINE='Traditional' then dummy=1; if ENGINE= ‘Advanced’ then dummy=2; else dummy=0;

Shouldn't that be

if ENGINE='Traditional' then dummy=1;

else if ENGINE= ‘Advanced’ then dummy=2;

else dummy=0;

if you don't have the else on the second line, I wouldn't think you would ever have the case where dummy=1;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 6 replies
  • 731 views
  • 0 likes
  • 3 in conversation