Demo entry 6641665

sas

   

Submitted by anonymous on Sep 19, 2017 at 14:54
Language: SAS. Code size: 1.5 kB.

/*****************************************
Name: task1_a1
Data: 16/09/2017
Derscription: this program uses univariate procedure to 
generate some basic statistics on the return data of 3 
stocks (General Signal Corp. (permno 12095), Wrigley Corp. (permno
15472) and Interlake Corp. (permno 15747)).The method of grouping 
the stocks is Where clause.
******************************************/

libname worklib 'C:\shanglinzhe\工作学习项目\研究生课程\Investment\Lecture1\Assignment';

* Load the return data of 3 stocks into 3 datasets respectively;
data data_GeneralSignal;
	set worklib.a1_data_stocks(where = (permno = 12095) rename = (ret = ret_GS ));
	keep permon date ret_GS;
	ret_GS = ret_GS*100;
run;
data data_Wrigley;
	set worklib.a1_data_stocks(where = (permno = 15472) rename = (ret = ret_W ));
	keep permon date ret_W;
	ret_W = ret_W*100;
run;
data data_Interlake;
	set worklib.a1_data_stocks(where = (permno = 15747) rename = (ret = ret_I ));
	keep permon date ret_I;
	ret_I = ret_I*100;
run;

* Sort 3 datasets respectively and merge them by date;
proc sort data = data_GeneralSignal;
		by date;
run;
proc sort data = data_Wrigley;
		by date;
run;
proc sort data = data_Interlake;
		by date;
run;
data data_merge;
		merge data_GeneralSignal data_Wrigley data_Interlake;
        by date;
run;

* Using univatiate to obtain statistics;
proc univariate data = data_merge;
		var ret_GS ret_W ret_I;
run;


	

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).