Computational Economics and Business ECON30025/ ECOM90020
Computational Economics and Business
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Computational Economics and Business ECON30025/ ECOM90020
Tutorials
Week Tutorial Topic Tutorial Exercises
1 1. Intro to SAS program
2 2. Creating and combining data series Data manipulation in SAS
3 3. Graphics methods overview Representing data
4 4. Linear algebra basics Practice examples
5 5. Multivariate Analysis in IML Numerical Methods in IML
6 6. Analysis of the Australian IO tables Input Output in IML
7 7. Assignment #1 Review
8 8. Linear programming in Excel Example solutions for LP problems
9 9. Doing DEA Example DEA setups
10 10. Quantile Regression Using IML and Proc Quantreg
11 11. The Simulation of an inventory A Queuing problem
12 12. Assignment #2 Review
1. Introduction to SAS
From this tutorial you should have the following takeaways:
Learn features of the SAS computer system
o To run SAS code from your computer using myuniapps.
Finding files on your computer.
Pasting code into the editor.
Cutting and pasting results into a word file.
o To be able to perform the following steps in the interactive mode.
Change editor styles.
To read a log file.
To examine data sets.
To use SAS output files.
o To navigate SAS help files.
Finding the details of the syntax of different Proc commands.
Locating different function commands that can be used in Data files.
When in doubt use the internet to search for answers.
SAS is a proprietary program that can only be accessed in the full version via a site licence from
SAS. Usually, this would not pose a problem at the University of Melbourne since we have a licence for all
computers at Melbourne. However, due to the limitations on the return to campus we are unable to use the
labs and tutorial rooms that have the program installed we need to use the myuniapps website1 that allows
the use of a CITRIX connection to a server on campus. This method is the easiest method for access but
requires a continuous connection to the university server. It can be accessed via computers with different
operating systems with the appropriate CITRIX receiver software. Be advised that this software has recently
been updated and if you have a older version you need to update it and restart your computer. At some point
in the use of this method you will need to allow the system to access your computer's files. Later in the
subject you will also find that you can get access to other software such as Eviews, Stata, and Scientific
Workplace that we will use for some limited examples.2
I have put all the data that needs to be read on a public website as csv files that can be read from
anywhere. SAS will read these so that it is not necessary to store them on your computer. The cloud
version of SAS will read them as well as the myuniapps version.
This tute is primarily a demonstration tute to show how these tasks can be done.
where you can find extensive descriptive videos
on how to download and install this program. It does require a bit of patience. It is more complex than the myuniapps approach
in that it requires that you install a virtual computer on your computer but once you have done this the program resides on your
computer. In the past I would have said this was the best way however SAS has decided to discontinue this approach for students
to move to a cloud based approach only in August of this year with the last chance to download this version is April 30, 2021.
The cloud based option is the "SAS OnDemand" software that can be found at: https://www.sas.com/en_au/software/on-demand-
for-academics/references/getting-started-with-sas-ondemand-for-academics-studio.html . This software option is running SAS
Studio which has a slightly different interface from the SAS I use and is available from the myuniapps site. The code is the same
and the results are the same as well. The editor is slightly different. However, the reliance on the same underlying program
means that all the routines we use here will run in this environment. Even if you have difficulty reading your computer's files you
can cut and paste the programs (they are all text files) into the on-line source code editor. There are numerous videos of how this
operates and there is on line support. To use this approach, you will need to create a profile.
2. Creating and combining data series
From this tutorial you should have the following takeaways:
Understand the concept of the two forms of SAS programs the DATA step and the PROC step.
o To be able to perform the following steps in the data steps.
To use only a subset of the observations (rows).
To keep or drop a subset of the variables (columns) in the data set.
To create multiple dataset with one data step.
To combine multiple datasets by stacking them on top of each other.
To combine multiple datasets by concatenating or merging them.
To reconfigure a dataset from the wide view with multiple columns to a long view with
more observations into a single column (as done with the weather data).
o To be able to use some basic PROCs and follow the syntax of the commands.
To estimate a regression with automatic dummy variables using Proc glm.
To generate multiple plots categorised by a variable.
To use a PROC to create a summary data set
The purpose of this tutorial is to provide some experience with SAS to create data sets of varying
types for analysis.
You may download the programs for this tutorial from the LMS programs web-site. There is a zip
file with all the programs we have (note I will be updating these as we have more topics). Alternatively, you
can download individual ones as well.
First, open SAS,
Load the footy_new program from where you have placed the unzipped programs.
Once you have read the program It should look like
The parts of the footy_new routine
1. We read data from a csv file that contains data from the AFL website that lists the outcome of all the
regular season football games from 1970 to 2006. Note this file is located on a website that we can
access from off-campus as well as on-campus. This means you do not need to copy the data to a
separate location.
2. From this data we create a new set with some transformed data and we label the variables for latter
use.
3. We then demonstrate how we can summarize the data by creating summary data series.
4. Then we read another csv file of weather data as provided by the Australian Bureau of Meteorology
website.
5. This data is available by month (daily data is more difficult to obtain). These observations can then
be used to define a monthly time series from 1900 to 2008 for rainfall in Melbourne as measured in
millimetres.
6. It is then possible to take these two data sets and determine if the attendance at football games at the
MCG is influenced by the amount of rainfall during the month.
Extra Questions:
1. Try creating some other combinations of the game data such as home goal accuracy or away
team accuracy.
2. Add the month the game was played as another variable to explain changes in the attendance.
To do this you need to add month to the regression.
* footy_new
Read Footy data from the excel file
This data is from the AFL website
;
Title "Footy Analysis" ;
filename csvFile url
proc import datafile=csvFile out=footy replace dbms=csv; run;
*
Add labels to the names
;
Data footy1 ; set footy ;
*
Create a SASdate variable and determine
the day of the week the game was played.
A measure of kicking accuracy on the day by the ratio of total kicks on goal
to the number of goals.
Also add a format for the date.