본문 바로가기

자격증/SAS BASE

Chapter 3. Accessing Your Data

Q. Libref 언제까지 유효한지?

  • Libref remain in effect until the LIBNAME statement is changed, canceled or until the SAS session ends
  • LIBNAME statement 가 변경되거나 취소되거나 SAS 세션이 끝났을 때까지 해당 libref 는 유효하다.

 

Q. Default Engine 을 사용한다면

  • When using the default engine, you do not have to specify the engine name in the LIBNAME statement                  (default engine 을 사용한다면 LIBNAME statement에 엔진이름을 따로 정의할 필요 X )
  • But , libref, SAS data library name 은 지정해주어야 한다 !!

 

Q. Engine for library 를 정의할 때 무엇을 specifying 하고 있는지?

  • Engine : SAS library 에 있는 파일들을 읽고 쓸수 있게 해주는 set of internal instruction 이다.
  • 각각의 엔진들은 library 에 저장되어있는 파일의 포멧을 지정한다.
  • 이를 통해 특정한 포멧을 가진 파일에 access 할 수 있다.
  • Some Engine : SAS 파일에 접근 / Other Engine : 다른 vendor's file 에 접근

 

Q. Summary of all the files 를 출력하기 위한 statement 찾기

  • Period (.) _ALL_ nods;
  • proc contents data=area51._all_nods;
  • use Period to append the _ALL_ option
  • 여기서 nods 는 파일에 대한 디테일한 정보 출력을 막는다.         
  • (NOD option suppresses detailed information about the files)

 

Q. Rule for assigning a libref

  • 8자 이내의 문자 (1 ~ 8 character long) 
  • letter 또는 underscore 로 시작해야 한다.
  • nuber, letter, underscore 만 포함한다.
더보기

SAS 파일 구성 및 라이브러리 생성

 

-  SAS 파일 구성 

  • 사용형식 : libref.filename
  • libref : name of SAS data library
  • filename : name of the file 

- SAS 라이브러리 생성

  • LIBNAME libref engine 'directory-path'
  • libref : 8자 이내의 문자 (문자로 시작, 문자,숫자, _ )
  • engine : 라이브러리에 저장되는 file 에 대한 file 형식 지정
  • V9 (default) SAS
  • SPSS Portable file (*.por)
  • ORACLE SAS / ACCESS Engine : DBMS

 

Q. CONTENTS procedure

  • the contents of a libra
  • descriptor information for an individual SAS data set

 

 

Q. LIBNAME statement

  • LIBNAME statement is global  
  • 따라서 Libref remain in effect until the LIBNAME statement is changed, canceled or until the SAS session ends.
  • the LIBNAME statement assigns the libtref for the current SAS session only.
  • must assign a libref before accessing SAS file that are stored in permanent SAS data library.
  1.  LIBNAME statement can be stored with a SAS program to reference the SAS library automatically when you submit the program
  2.  When you delete a libref, SAS no longer has access to the files in the library. However, the contents of the library still exist on your operating system
  3.  you can access files that were created with other vendor's software by submitting a LIBNAME statement

 

 

Q. 코드 해석  libname states 'C:\myfiles\sasdata\popstats';

  • define a library called States using the default engine.
  • LIBNAME statement  does not specift an engine
  • 따라서 States 라는 library 를 만들기위해 default engine 을 사용했다