Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer this in SAS. The data set is also attached below, thanks. Refer to

ID: 3357112 • Letter: P

Question

Please answer this in SAS. The data set is also attached below, thanks.

Refer to the attached Data Set 1, with variables Stock, Price, Net, Volume. Assume that the data in Data Set 1 has been stored in SAS data set WORK.Stocks

(a) Write a command to store stocks with a net gain in price in a separate data set named WORK.PosStocks

(b) List the records that were stored in PosStocks

(c) Write commands that store WORK.PosStocks in permanent SAS data set Stock.PosStocks. Be sure to include LIBNAME while specifying a directory of your choice

(d) Write a command to store stocks with a net gain in price and a volume less than 20,000,000 shares. Call this new data set WORK.SmallPos

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

(a) We are to create a dataset to contain the records having posititve gain in a seperate data set.

The code is:

data work.posstocks;

set work.stocks;

where Net > 0;

run;

(b) To list the observations that are present in PosStocks, we use the following code:

proc print data = work.PosStocks;

run;

The output is :

CSCO 18.56 +.12 46132122

QQQ 58.94 .09 39018248

ORCL 33.69 .03 25484458

MU 5.88 .18 21026866

HBAN 5.47 .07 18692444

(c) To store the dataset PosStocks in a permanent library names Stock, we first need to define a library with libref Stock. The code is as follows:

libname Stock "E:AssignmentCheggNov";

data Stock.PosStocks;

set work.PosStocks;

run;

(d) Now we have a double filter : (i) There is a positive gain in price and (ii) Volume less than 20,000,000.

The code is as follows:

data work.SmallPos;

set work.Stocks;

where Net > 0 and Volume < 20000000;

run;

<Copy each of the codes in SAS window and run>