BookmarkSubscribeRSS Feed
ferlopz298
Calcite | Level 5

Hi,

    I am new to SAS and wanted to get some feedback on a problem. I am only in Chapter 2 so I have a lot to learn still. I am stuck on a problem and need help to understand how the code should be formatted. I think my order of operations is off with the math portion causing errors. See below, for the scenario the book has listed and the code I entered. I appreciate any feedback! I don't want to get discouraged and give up but I don't have a teacher to explain these things to me either. PLEASE HELP!

 

2. Given the program here, add the necessary statements to compute four new variables:

a. Weight in kilograms (1 kg=2.2 pounds). Name this variable WtKg.

b. Height in centimeters (1 inch=2.54 cm). Name this variable HtCm.

c. Average blood pressure (call it AveBP) equal to the diastolic blood pressure plus one-third the difference of the systolic blood pressure minus the diastolic blood pressure. 

d. A variable (call it HtPolynomial) equal to 2 times the height squared plus 1.5 times the height cubed.

 

Code:

 

data prob2;
input ID$
Height /* in inches */
Weight /* in pounds */
SBP /* systolic BP */
DBP /* diastolic BP */;
HtCm=1 inch = 2.54 cm;
WtKg=1 kg = 2.2 pounds;
AveBP=DBP+1/3(SBP-DBP);
HtPolynomial=2*HtCm**+1.5*HtCm***;
cards;
001 68 150 110 70
002 73 240 150 90
003 62 101 120 80
;
title 'listing of prob2';
proc print data=prob2;
run;

1 REPLY 1
PaigeMiller
Diamond | Level 26

I'll show you the proper code for converting height to cm. You can take that and figure out the other ones.

HtCm=2.54 * height;

 

--
Paige Miller

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 1027 views
  • 0 likes
  • 2 in conversation