Assignment Ch2 RON Cody

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Assignment-1

Ch-2
1)- a)
Data Portfolio;
/*This is a simple SAS Program to input txt file and add a new column (Value)
Sunidhi Mishra 22-06-2022*/
Infile “\Data\SasTraining\stocks.txt”
Input Brand $ Price Number;
Value=Number*Price;
Run;
1)-b)
Proc Means Data=”Portfolio”;
Var Price Number;
Run;
2)-a) ,b) ,c), d)
data prob2;
input ID $
Height /* in inches */
Weight /* in pounds */
SBP /* systolic BP */
DBP /* diastolic BP */;
WtKg=Weight/2.2 ;
HtCm=Height*2.54;
AveBP=DBP+(1/3*(SBP-DBP));
HtPolynomial=2*(Height**2)+1.5*(Height**3);
Datalines
001 68 150 110 70
002 73 240 150 90
003 62 101 120 80
;
title "Listing of PROB2";
proc print data=prob2;
run;

3)Assignment Statement
EMF=(1.45* V)+ ((R/E) * (V**3))-125;
4)
001 data new-data;
002 infile prob4data.txt;
003 input x1 x2
004 y1 = 3(x1) + 2(x2);
005 y2 = x1 / x2;
006 new_variable_from_x1_and_x2 = x1 + x2 – 37;
007 run;
Note: Line numbers are for reference only; they are not part of the program.

Soln-
In line no. 001 the data step name is not valid as it contains hyphen(-) symbol
In between which is not allowed.
In line no. 002 the path of the file is not inside double-quotes(“….”).
In line no. 003 semicolon(;) is missing.
In line no. 004 statement should contain ‘*’ operator instead of brackets.
y1 = 3*x1 + 2*x2;

You might also like