0% found this document useful (0 votes)
0 views

Exercise on Looping

Uploaded by

tanay rishu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Exercise on Looping

Uploaded by

tanay rishu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Q1.

Write a DATA step to create a conversion table for pounds and


kilograms. Pounds should be in a column ranging from 0 to 200 in steps of
100. Column 2 should be the kilogram equivalents. Assume 1 kg = 2.22
pounds
Q2. Write a program to create a table with column 1 containing the
integers from 1 to 50, column 2 the square root of column 1 and column 3
the square of column 1. You can use SQRT function or exponent of 0.5 to
compute the square root.

Ans 1

data ConversionTable;
do Pounds = 0 to 200 by 100;
Kilograms = Pounds / 2.22;
output;
end;
run;

proc print data=ConversionTable noobs;


title "Conversion Table: Pounds to Kilograms";
run;

Ans 2

data MathTable;
do Integer = 1 to 50;
SquareRoot = sqrt(Integer); /* or Integer**0.5 */
Square = Integer**2;
output;
end;
run;

proc print data=MathTable noobs;


title "Math Table: Integers, Square Roots, and Squares";
run;

You might also like