REGRESSION & ECONOMETRIC
REGRESSION & ECONOMETRIC ECON 465
Popular in Course
Popular in Economcs
This 6 page Class Notes was uploaded by Mr. Freda Friesen on Wednesday September 30, 2015. The Class Notes belongs to ECON 465 at Western Kentucky University taught by Staff in Fall. Since its upload, it has received 24 views. For similar materials see /class/216761/econ-465-western-kentucky-university in Economcs at Western Kentucky University.
Reviews for REGRESSION & ECONOMETRIC
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/30/15
Econ 465 Spring 2007 Pr L SAS Primer For most of the class all you need to know is how perform some simple operations in SAS importing data displaying data summary statistics graphing Running a regression Navigating SAS The structure of SAS is very much like windows there are multiple windows within SAS that perform various functions Here are brief descriptions of those win ows 57 9quot 0 run quot7 Editor 7 this is where you will type your program A program is a set of instructions telling SAS what you want it to do Log 7 this is where you should look rst after running a program All errors encountered during program execution will be listed there Output 7 when everything works OK this is where your numerical results will be displayed Graph Output 7 this is where the graphs will be displayed Results 7 when you run a program it produces a set of results If you run the same program multiple times or multiple programs you will generate output for each run 7 all that output will be stored until you shut down SAS The results you have produced are grouped in the Results window Explorer This is a relatively new feature of SAS In Explorer under LibrariesgtWorkgt you will see datasets you have createdimported into SAS So when you import data 7 it should show up there If you double click on the data le it will display it in way much like Excel 2 Interacting with SAS writing programs The most common way to interact with SAS is by writing programs a set of instructions describing what you want SAS to do There are several things you need to know about writing SAS programs a b 0 F 5 1quot Every command line ends with semicolon there are some exceptions though You can insert comments eg notes to yourself into programs by using and You execute a program by hitting F8 or by clicking on a button with a little guy on it SAS is based on procedures 7 procs 7 intended to perform a particular function For example to run a regression you will have to write l39 i i39 I followed by some other instructions on how exactly you want to run that regression You must ALWAYS include m at the end of your program You can also include it at the end of each PROC SAS is not usually casesensitive 3 P How to read import ASCII les into SAS An ASCII le is a text le It can have different extensions dat txt and some others These are the easiest les to read into SAS and other statistical programs for that matter and this will be the format in which I will supply data for your assignments If you have Excel SPSS or any other data for your project open it in that program and save it as text Then read it into SAS as a text le Suppose you have a le saved on a USB ash drive The letter for that drive is I it might be different on your computer The le name is mydata tXt To read it into SAS you will have to write a little program This program will start with the following lines The rst line of the program creates an empty SAS data le called test Think of it as a place where you told SAS to keep your data after it reads them from your le The second line of the program m tells SAS to read the data and where your data are located Before data are read you will have to supply SAS with some more instructions Importing data continued How to read data les that contain variable names and other info Sometimes data les contain only number Often data les have extra stuff in them 7 description of the data variable names You should always examine your data before importing it into SAS ie open it in Excel or Notepad to see how many variables you have what are their names etc If your data contain that extra stuff you have to tell SAS that it needs to skip a few lines before reading your data by modifying the infile line In the above example you tell SAS to skip the rst row in the le and start reading the data at the second row 5 9 l Importing data continued How to assign variable names After SAS reads the data it will assign some cryptic names to each variable VAROOl VAROOZ etc You can tell SAS to use other names you want for the variables Suppose your data look like this x y z 1 10 11 3 22 64 2 17 34 To assign names you can modify the program like this How to display data on the screen After you imported you le you might want to look at it to make sure it was imported correctly Yu need to check the number of observations and look at the last observation if what you have matches your source data 7 your import succeeded To display your data add the following lines to your code If you imported multiple data les into SAS you can specify which one you want to display How to calculate descriptive statistics To calculate descriptive stats use the following command F 8 D 0 How to create a histogram 0 create a h T istoram you have to call a procedure UNTVARIATE 39 g quotx 1 17 SAS automatically calculates how wide the bins should be in the histogram You can change the appearance of the histogram by changing the midpoints of the bins Above will force SAS to use 25 bins 04 48 etc This is especially useful if you have several dataset eg different stock returns and you want to make sure that the histograms are on the same scale How to draw a scatter plot Scatter plot is probably the most useful graph in econometrics There is more than one way to draw it in SAS One way is by using PROC GPLOT Suppose you have imported a le containing variables X y and 2 To create a scatter plot add the following code The example shows several useful options for graphing a The rst line plot yx will produce a scatter plot and it will put y on vertical and X on horizontal aXis b The second line plot y ZX overlay will produce two plots but it will put them in the same graph c The third line adjusts the scale of horizontal aXis How to run a regression To run a regression we can use PROC REG procedure there are other procedures built into SAS that will produce the same calculations 7 more on that later Suppose we are working with the same le that has variables Xy and z and we want to estimate the following regression equation y a bX The commands for this regression would like lie this 11 How to run a regression continued Proc reg can also produce scatter plots To generate the scatter plots add the following lines to your program p A p A You should ALWAYS use the plot command built into PROC REG for any graphs involving residuals or tted values How to save your work The most important part of your work that needs to be saved is your program To save your program a Click on Editor window b Click File gt Save or Save as Printing output There are many ways to print your work in SAS An good way to do it is to use the RESULTS browser window Simply select the part of output you want to print and either click FilegtPrint or rightclick and select Print Econ 46S Econometrics Spring 2007 Lebedinsky Learning SAS On my website under Econ 465Examp7es Used in C7ass you can find a fi1e chicktxt Use that fi1e to do the fo11owing l Down1oad the fi1e to the PC Put it somewhere on the hard drive or on your USB f1ash drive I suggest some p1ace that is easy to find Ctemp 2 Open that fi39le in notepad and take a 100k at it a Notice where the first observation is b Notice the names of the variab1es write them down or save them in another fi1e 3 Write the SAS program that performs the fo11owing operations a Data step that imports data into SAS i The data fi1e contains a brief description of data You have to make sure that on1y ACTUAL data are imported ii In the INPUT 1ine use the variab1e names you saved in step 2 U39 Disp39lay the data i Check to make sure there are no missing observations c Ca39cu39ate Descriptive statistics 1 Do them for a1 variab1es ii Do descriptive stats just for Pchick d P1ot your data using Proc Gp1ot Make the fo11owing graphs i year on x pchick on y ii year on x income on y iii pchick on x qchick on iv You can p1ot mu1tip1e series in the same graph Try this command plot Pichick Piporkyear overlay e Run a regression to estimate the demand function for chicken QTCh1Ck BO BlPchick Find the estimates and interpret them f In the regression step p1ot qchick vs pchick g By now you shou1d have noticed that there is an out1ier in your data Find it in your text fi1e and fix it it is a misp1aced period h Redo the regression Did your estimates change by much
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'