To remain ahead of market trends is critical in the fast-paced world of finance, where every action may have a significant impact. Investors, both experienced and inexperienced, are increasingly turning to data-driven solutions to help them negotiate the complexity of the stock market. In this blog, we will explore the tools and approaches that enable investors to make informed judgments in the stock market.
Stock market data research is more than just predicting future prices; it is a comprehensive methodology that includes studying past patterns, finding prospective growth possibilities, and reducing risks. The toolkit for studying stock market data has evolved, allowing a varied range of options to investigate.
We will start by loading in the CSV file, this data was provided by Kaggle. The dataset variable consist of Stock_Date, Open, High, Low, Close, Adj_Close( Adjusted Close), and Volume.
proc import datafile="/cisviya-export/cisviya/homes/Dee.McKoy@sas.com/Blgdata/data/Stock_Market_Dataset.csv"
out=work.marketdata
dbms=csv
replace;
run;
data market;
set work.marketdata;
format Stock_Date date9.;
if cmiss(of _all_) then delete;
run;
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
Now that we have an idea of what the data provides, let's take a look at the descriptive statistic.
proc means data=market;
var Open High Low Close Volume;
run;
From the above Figure we are able to gain some insight into the dataset that we are using in this blog. The means for each variable Open, Low, High , and Close are all range between 35 and 36 for price of the stock. We also see from the descriptive statistic the minimum and maximum of each variable which could help us moving forward in the demo.
proc sgplot data=market;
series x=Stock_Date y=High / lineattrs=(color=blue) legendlabel='High' datalabelpos=TOPRIGHT;
series x=Stock_Date y=Low / lineattrs=(color=red) legendlabel='Low';
xaxis label='Date';
yaxis label='Price';
keylegend / position=topright;
title 'High and Low Prices Over Time';
run;
The scatter plot with a regression line depicting the High and Low stock market price from 2013 to 2023. The date is represented by the x-axis, while the closing price is shown by the y-axis. The visualization allows for understanding of how a stock could fluctuate and what to monitored when a drops in the stock price may occur.
data StockMarketData;
set market;
MA10=mean(Close, 10);
format Open d4.2;
run;
proc timeseries data=StockMarketData out=TimeSeriesOutput;
id Stock_Date interval=semiyear setmissing=prev accumulate=average;
var Open;
run;
proc print data=TimeSeriesOutput;
run;
The next step of this process was to create a table using the proc timeseries function. This function forms a time series from the input time-stamped transactional data. It can provide results in output data sets or in other output formats by using the Output Delivery System (ODS).
proc sgplot data=TimeSeriesOutput;
series x=Stock_Date y=Open / markers datalabel;
xaxis label='Date';
yaxis label='Average Amount of Open Stock Prices';
title 'Time Series Plot Semi-Year for Open Stock Purchase';
run;
From the Figure, we are able to see the Average cost of each stock on a semi-year. From 2013 through 2015 the stock average price semi-year decreased until 2017, where the stock average price started to increase until 2020.
In conclusion, stock market data analysis is a journey rather than a destination. It's an ongoing process of learning, adapting, and refining strategies based on the ever-evolving nature of financial markets. Whether you are a seasoned trader or a newcomer to the investment landscape, the key lies in continuous education, a keen eye for market nuances, and an unwavering commitment to disciplined decision-making.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.