Question

You are given a text file called stockprices.txt containing information on the purchase and sale of...

  1. You are given a text file called stockprices.txt containing information on the purchase and sale of stocks. The data layout is as follows:

Variable

Description

Starting Column

Length

Type

Stock

Stock symbol

1

4

Char

PurDate

Purchase date

5

10

mm/dd/yyyy

PurPrice

Purchase price

15

6

Dollar signs and commas

Number

Number of shares

21

4

Num

SellDate

Selling date

25

10

mm/dd/yyyy

SellPrice

Selling price

35

6

Dollar signs and commas

A listing of the data file is:

stockprices.txt

IBM 5/21/2006 $80.0 10007/20/2006 $88.5 CSCO04/05/2005 $17.5 20009/21/2005 $23.6

MOT 03/01/2004 $14.7 50010/10/2006 $19.9

XMSR04/15/2006 $28.4 20004/15/2007 $12.7

BBY 02/15/2005 $45.2 10009/09/2006 $56.8

Create a SAS data set (call it Stocks) by reading the data from this file. Use formatted input.

Compute several new variables as follows:

Variable

Description

Computation

TotalPur

Total purchase price

Number times PurPrice

TotalSell

Total selling price

Number times SellPrice

Profit

Profit

TotalSell minus TotalPur

Print out the contents of this data set using PROC PRINT.

Homework Answers

Answer #1
| Program name: stocks. sas in c:\books\learning 
| Purpose: Read in raw data on stock prices and compute values 
 


-k * . 

*a; 

data portfolio; 

infile 1 c : \books\learning\stocks . txt ' ; 
input Symbol $ Price Number; 

Value = Number*Price ; 
run; 

title "Listing of Portfolio"; 
proc print data=portf olio noobs; 
run; 

*b; 

title "Means and Sums of Portfolio Variables"; 
proc means data=portf olio n mean sum maxdec=0; 
var Price Number; 


run; 
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
/* myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following...
/* myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT