analytics -2

15
Business Econometrics using SAS Tools (BEST) Class II – Introducing SAS Code

Upload: rohit-raj

Post on 15-Sep-2015

212 views

Category:

Documents


0 download

DESCRIPTION

Analytics ppt- 2

TRANSCRIPT

Business Analytics Tools and Techniques II

Business Econometrics using SAS Tools (BEST)Class II Introducing SAS CodeThe CODEWe worked with EG till nowBut, here is the Real DealOpen EG File>New>Code

OPTIONSPROC OPTIONS;RUN;Now open the LogIt allows you to make some changes to the SAS System or Output for the entire programIn EG Tool>OptionsEx: Results FormatInfile* Read data from external file into SAS data set; DATA uspresidents; INFILE 'c:\sasdata\President.dat'; INPUT President $ Party $ Number; RUN;ImportSyntax:PROC IMPORT DATAFILE = filename OUT = data-setDBMS = identifier REPLACE;Type of FileExtensionDBMS IdentifierExcel.xlsEXCEL/XLSdBase.dbfDBFJMP.jmpJMPLotus.wk4WK4Paradox.dbPARADOXSPSS.savSAVStata.dtaDTAImport Examplecsv*imports a csv file into sas;PROC IMPORT DATAFILE ='c:\sasdata\stocks.csv' OUT = stocks REPLACE;RUN;PROC PRINT DATA = stocks; TITLE 'Some Stocks and EPS'; RUN;Import .xlsAdditional details (if you need) Specify if you want to input only a certain sheet from the Excel FileSHEET = sheet-name;If you want to choose the range of data from a given sheet. Here UL is the Upper Left cell and LR is the Lower Right cellRANGE = sheet-name$UL:LR;Default in SAS is that the first lines in Excel imports are variable names. To change thatGETNAMES = NO;Import ExamplexlsPROC IMPORT DATAFILE = 'c:\sasdata\stocks.xls' DBMS=EXCEL OUT = stocks;RUN;PROC PRINT DATA = stocks;TITLE 'SAS Data Set Read From Excel File';RUN;Work with Project DataClient wants to create a model to predict TPNeed to understand if there are any relationships between the dependent and the independent variables

Work with live project dataPROC IMPORT OUT= WORK.payreg DATAFILE= "C:\sasdata\PaymentReg.csv" DBMS=CSV REPLACE; GETNAMES=YES; DATAROW=2; RUN;Where does one begin?Step 1 Check the dataWhat is the problem?In this case, 2 of the variables have been imported as charactersHow to fix it?Move the read only check mark in DataGo back to the data, select the columns > PropertiesNext stepStep 2 List the dataDo it in parts, if needed, to take a look into the datasetPROC PRINT DATA=WORK.payreg;VAR SR CS AR SC PIP; *drop this line if you want to list the whole data;RUN;Summary StatisticsPROC MEANS DATA=WORK.payregFW=4 MEAN STD MIN MAX N;RUN;CorrelationsPROC CORR DATA=WORK.PAYREGPEARSON;RUN;HistogramPROC UNIVARIATE DATA=WORK.payreg NOPRINT;VAR SR;HISTOGRAM / CAXES=BLACK CBARLINE=BLACK CFILL=BLACK PFILL=SOLID WAXIS=1;RUN;