Getting Your Data into SAS_2
Statistical Data Analysis 1
Namhyoung Kim
Dept. of Applied Statistics Gachon University
SAS library and Viewtable
2
Reading a permanent SAS data set
DATA=library.data_set_name;
Proc Step
Data Step
Reading files with the Import Wizard
4
Reading files with the Import Wizard
Reading files with the Import Wizard
6
Reading files with the Import Wizard
Reading files with the Import Wizard
8
Using IMPORT procedure
PROC IMPORT DBMS=EXCEL
DATAFILE="D:\SAS_Programming\Raw_Data\기업이미 지.xls"
OUT=mysas.company REPLACE;
RANGE="Sheet1$";
RUN;
PROC IMPORT DBMS=SPSS
DATAFILE="D:\SAS_Programming\Raw_Data\기업이미 지.sav"
OUT=mysas.company REPLACE;
FMTLIB=mysas.company_formats;
RUN;
Internal Raw Data
CARDS statements
10
Entering Data with the Viewtable Window
Practice
Drink 데이터셋을 생성하기 위하여 다음을 수행 하여 보아라
텍스트파일 ‘음료수.txt’를 이용하여 mysas.drink 데이 터셋을 생성하여라
Excel 파일 ‘음료수.xls’를 이용하여 mysas.drink 데이 터셋을 생성하여라
SPSS 파일 ‘음료수.sav'를 이용하여 mysas.drink 데 이터셋을 생성하여라
12
Practice
아래 자료를 텍스트 파일로 저장하고, 이 텍스트 파일을 INFILE 명령문을 이용하여 SAS 데이터셋 으로 저장하여라
1 Monona Steve 32 2 Milwaukee Tom 44
3 Madison Kim 25
변수 내용 열 번호
Obs 고객 번호 1-2
City 도시 3-12
Name 성명 13-18
Age 나이 19-20
<텍스트 자료> <코드북>
SAS library and Viewtable
14
Reading a permanent SAS data set
DATA=library.data_set_name;
Proc Step
Data Step
Reading files with the Import Wizard
16
Reading files with the Import Wizard
Reading files with the Import Wizard
18
Reading files with the Import Wizard
Reading files with the Import Wizard
20
Using IMPORT procedure
PROC IMPORT DBMS=EXCEL
DATAFILE="D:\SAS_Programming\Raw_Data\기업이미 지.xls"
OUT=mysas.company REPLACE;
RANGE="Sheet1$";
RUN;
PROC IMPORT DBMS=SPSS
DATAFILE="D:\SAS_Programming\Raw_Data\기업이미 지.sav"
OUT=mysas.company REPLACE;
FMTLIB=mysas.company_formats;
RUN;
Internal Raw Data
CARDS statements
22
Entering Data with the Viewtable Window
Practice
Drink 데이터셋을 생성하기 위하여 다음을 수행 하여 보아라
텍스트파일 ‘음료수.txt’를 이용하여 mysas.drink 데이 터셋을 생성하여라
Excel 파일 ‘음료수.xls’를 이용하여 mysas.drink 데이 터셋을 생성하여라
SPSS 파일 ‘음료수.sav'를 이용하여 mysas.drink 데 이터셋을 생성하여라
24
Practice
아래 자료를 텍스트 파일로 저장하고, 이 텍스트 파일을 INFILE 명령문을 이용하여 SAS 데이터셋 으로 저장하여라
1 Monona Steve 32 2 Milwaukee Tom 44
3 Madison Kim 25
변수 내용 열 번호
Obs 고객 번호 1-2
City 도시 3-12
Name 성명 13-18
Age 나이 19-20
<텍스트 자료> <코드북>
Practice
‘C:\’ 에 example 폴더를 생성하고 이 폴더를 ‘ex’
라는 이름의 SAS 라이브러리로 생성하여라. 생 성한 ‘ex’ 라이브러리에 문제 2-6번의 데이터를 저장하여 보아라.
26
Practice
아래의 데이터셋을 엑셀 파일로 저장하고
IMPORT 프로시저와 데이터 가져오기 마법사를 각각 이용하여 저장한 엑셀 파일을 SAS 데이터 셋으로 변환하여라.
Region State Month Expenses Revenue
Southern GA JAN2001 2000 8000
Southern GA FEB2001 1200 6000
Southern FL FEB2001 8500 11000
Northern NY FEB2001 3000 4000
Northern NY MAR2001 6000 5000
Southern FL MAR2001 9800 13500