Please answer this in SAS. The data set is below as well. Thanks Refer to the at
ID: 3357819 • Letter: P
Question
Please answer this in SAS. The data set is below as well. Thanks
Refer to the attached Data Set 1, with variables Stock, Price, Net, Volume
(a) Write the INPUT statement you would use to read the data set as free format
(b) Now write another INPUT statement to read the data set as column-formatted input
(c) Using the @ command, write an INPUT statement that only reads Volume if Net is negative
Data Set 1:
/*--5---10---15---20---25---30---35*/
CSCO 18.56 +.12 46132122
INTC 24.98 -.15 42953742
QQQ 58.94 .09 39018248
CMCSA 23.85 -.74 36769304
ORCL 33.69 .03 25484458
MU 5.88 .18 21026866
YHOO 16.56 -.07 19399112
HBAN 5.47 .07 18692444
DELL 16.31 -.01 18210492
Explanation / Answer
"""The @ sign helps sas understand the column secified for the variable """
""" Assuming that the data is present in a path :- 'homedocuments'"""
Filename import_dataset_path='homedocuments'
Data stock;
infile import_dataset_path;
input stock $1-5 @6 price 6. @11 net 4. @16 volume 10.;
run;
""" When you want to input conditionally """
data positive-stock;
infile import_dataset_path;
input stock $1-5 @6 price 6. @11 net 4.;
if net <0 then do;
input @16 volume 10.;
end;
run;