• 검색 결과가 없습니다.

SAS-data-set options

N/A
N/A
Protected

Academic year: 2022

Share "SAS-data-set options"

Copied!
23
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Processing SAS Data Sets_2

Statistical Data Analysis 1

Namhyoung Kim

Dept. of Applied Statistics Gachon University

nhkim@gachon.ac.kr

(2)

Changing Observations to Variables  Using PROC TRANSPOSE

PROC TRANSPOSE

 PROC TRANSPOSE DATA=

SAS-data-set options

; BY

variables

;

ID

variable

; VAR

variables;

RUN;

 BY statement: You can use the BY statement if you have any grouping variables that you want to keep as variables. (X in example)

(3)

Changing Observations to Variables  Using PROC TRANSPOSE

 Example 8.13

(4)

Changing Observations to Variables  Using PROC TRANSPOSE

 Example 8.14

(5)

Managing SAS Data Set Using PROC  DATASETS

The DATASETS procedure is a utility procedure that manages your SAS files

APPEND statement

 append SAS data sets

NOLIST: Suppress the printing of the directory

FORCE: forces the APPEND statement to concatenate data sets when the DATA= data set contains variables that either

are not in the BASE= data set

do not have the same type as the variables in the BASE=

data set

are longer than the variables in the BASE= data set.

(6)

Managing SAS Data Set Using PROC  DATASETS

CONTENTS statement

 list the attributes of a SAS data set, such as:

 the date when the data was last modified

 whether the data is compressed

 whether the data is indexed

(7)

Managing SAS Data Set Using PROC  DATASETS

COPY statement

 copy SAS files from one SAS library to another

 DELETE statement

 delete SAS files

 CHANGE and EXCHANGE statements

 rename SAS files

(8)

Managing SAS Data Set Using PROC  DATASETS

 Example 8.17 8.18

(9)

Managing SAS Data Set Using PROC  DATASETS

MODIFY statement

(10)

Store the SAS log or Procedure  Output

PROC PRINTTO

 PROC PRINTTO options;

RUN;

 Options

 PRINT=‘filename’ : route procedure output to a permanent external file.

 LOG=‘filename’ : route the SAS log to a permanent external file.

 NEW : replace the file instead of appending to it

(11)

Store the SAS log or Procedure  Output

 Example 8.20

(12)

Using ODS Statements to Create  HTML Output

 Output Delivery System

 Procedures produce only data and send that data to the ODS which determines where the output

should go(destination) and what it should look like when it gets there

 Destinations

 LISTING: Whenever you don’t specify a destination, your output will be sent, by default, to the

listing(output window)

 HTML: Hypertext Markup Language

(13)

Using ODS Statements to Create  HTML Output

 Example 8.21

(14)

AUTOEXEC File

 The AUTOEXEC.SAS file is a regular text file

that contains SAS statements that are executed when SAS is first started.

 AUTOEXEC.SAS is an external file located in the

same physical location as SAS.EXE .

(15)

AUTOEXEC File

 Example 8.22

(16)

Practice

8-1 다음 데이터는 5명의 사람으로부터 설문문항들을 조사한 것으 로, 첫 세 개의 열은 응답자의 id, 네 번째 열은 성별, 다섯 번째 열은 연령대, 나머지 열들에는 세 개의 설문문항이 각각 하나의 열로 기 록되어 있는 데이터이다. 각각의 변수명은 id, gender, agegrp, item1, item2, item3라고 하자. 이때 item1, item2, item3 변수들의 합을 구한 다음 그 합이 큰 값에서부터 작은 값의 순으로 정렬한 결 과를 저장한 새로운 데이터셋을 생성하여라.

(17)

Practice

8-2 문제8-1에서 만든 데이터셋에서 성별이 m인 경 우만 출력해 보아라.

8-3 문제 8-1의 데이터에 대해서 다음표와 같이 재 표현하는 프로그램을 작성하여라.

a. 변수 gender에 대해 m=Male, f=Female.

b. 변수 agegrp에 대해 1=20세 이하, 2=21세 이상 40세 이하, 3=41세 이상 60세 이하, 4=60세 이상.

c. 변수 item1-item3에 대해 1=강한 부정, 2=부정, 3=그저 그러함, 4=긍정, 5=강한 긍정.

<힌트> FORMAT 프로시저를 사용하여 각 변수에 대해 사 용자 출력포맷을 작성하고 데이터 단계에서 FORMAT 명령 문으로 포맷을 지정할 것.

(18)

Practice

8-4 4개의 변수(Company, Debt, AccountNumber, Town)

에 대한 자료값들이 다음과 같을 때, 이를 SAS 데이터셋

으로 생성하고 마을(Town)과 회사(Company)에 따라 정

렬하여라.

(19)

Practice

 8-5 문제 8-4번에서 정렬한 데이터셋을 PRINT

프로시저를 이용하여 마을(Town)별로 부채(Debt)

의 합을 출력하여라.

(20)

Practice

8-6 4개의 변수(Company, Date, Time, Price)에 대한 자료값들이 다 음과 같을 때, 이를 SAS 데이터셋으로 생성하고, Transpose 프로시 저를 이용하여 회사(Company)의 각 수준을 그룹으로 하여 개체와 변수의 위치를 바꾸어라. 이때 날짜(Date)변수의 항목을 새로운 변 수로 지정하여라.

(21)

Practice

8-7 DATASETS 프로시저를 이용하여 기존 데이터셋에 새로운 데이 터셋의 개체를 추가하여라. 이때 기존 데이터셋에 존재하는 변수들 에 대해서만 개체를 추가하여라.

기존 데이터

새로운 데이터

(22)

Practice

 8-8 세 개의 변수(Name, Present, Taste)에 대한

자료값들이 다음과 같을 때, 이를 SAS 데이터셋

으로 생성하고, RANKS명령문을 이용하여 변수

Present와 Taste에 대해서 순위값을 출력하여라.

(23)

Practice

 8-9 sashelp.shoes 데이터를 이용하여 Product를

Boot에 한정하여 지역(Region)별로 판매액(Sales)

의 기초통계량을 출력하고 비교하여라.

참조

관련 문서

ㆍ An Economic Framework of the Singapore Economy: Principles and Issues, with Linda Low, Singapore: McGraw-Hill Book Company, 1990. ㆍ Policy Options for the Singapore Economy,

• WISE KMA는 Search Formula-1 및 WISE CIMS에 기본 탑재되어 제공되며, 형태소분석기만 원하는 고객 에게도 독립적으로

광고나 캠페인이 아닌, 개발중인 자동차 자체의 디자인이나 색상, 스펙 등에 대한 소비자 반응 평가 실험도 가능함2. 브랜드

한국의 경우 OUT-IN 에서는 JF Asset Management Ltd, Capital Research &amp; Management Company, Capital Research &amp; Management Company, Standard Chartered plc, Citigroup

frame ·concept·logic·positioning McKinsey&amp;Company frame·concept·logic·positioning McKinsey&amp;Company frame·concept·logi positioning McKinsey &amp;

엔티티 타입 EMPLOYEE는 Name, SSN, Sex, Address, Salary, BirthDate, Department, Supervisor 애트리뷰트들을 가진다.. 사용자가 사원 Name의

Company

This much has emerged after analysing the resale values of Korean versus Japanese cars, reports True Price.. Darryl Jacobson, managing director of True Price, explains that