본문 바로가기

자격증/SAS BASE

Chapter 16. Creating Output

Q. Using ODS statements, how may types of output can you generate at once?

(as many as you want)

  • You can generate any number of output types as long as you open ODS destination for each type of output you want to create
  • The output from a SAS program can be converted to more user friendly forms like .html or PDF. This is done by using the ODS statement available in SAS. ODS stands for output delivery system. It is mostly used to format the output data of a SAS program to nice reports which are good to look at and understand. That also helps sharing the output with other platforms and soft wares. It can also combine the results from multiple PROC statements in one single file.

출처 : https://www.tutorialspoint.com/sas/sas_output_delivery_system.htm

 

 

 

 

Q. If ODS is set to iis default settings, what type of output are created by the following code?

   

       ods html file='c:\myhtml.htm' ;

       ods pdf file='c:\mypdf.pdf' ;

 

  • HTML and PDF
  • HTML output is created by default in the SAS windowing environment for the Windows operating environment and UNIX.
  • so, these statement create HTML and PDF output.
  • Windows 환경에서 HTML output 은 기본으로 생성된다.

 

 

 

 

Q. What is the purpose of closing the HTML destination in the following code?

 

     ods  HTML close ;

    ods  pdf ... ;

 

  • It conserves system resources.
  • By default, in the SAS windowing environment for the Windows operating environment and UNIX, SAS programs produce HTML output.
  • If you want only RTF output, it is good idea to close the HTML destination before creating RTF output,
  • as an open destination uses system resources.
  • Open destination 할 때 system resource 를 사용하기 때문에, 자동으로 생성되는 HTML destination을 다른 RTF output을 생성하기 전에 닫는것이 좋다.

 

 

 

 

 

Q. When the following code runs, what does the file D:\Output\body.html contain?

 

     ods html body = 'd:\output\body.html' ;

     proc print data=work.alpha ;

     run ;

     proc print data=work.beta ;             ------------------------→  Multiple procedures

     run ;

     ods html close ;

 

 

  • The PROC PRINT output for both Work.Alpha and Work.Beta
  • When multiple procedures are run while HTML output is open.
  • precedure output is appended to the same body file.

 

 

 

 

 

Q. When the following code runs, what file is loaded by the links in D:\Output\contents.html?

- CONTENTS = option -

 

    ods html body = 'D:\output\body.html' 

           contents = 'D:\output\contents.html'

           frame = 'D:\output\frame.html' ;

 

 

  • 다음 코드가 실행 되었을 때, D:\Output\contents.html 링크로 load 되는 파일이 무엇인지?             
  • D:\Output\body.html
  • The CONTENTS = option creates  a table of contents containing links to the body file, D:\Output\body.html
  • ★ CONTENTS = option 은 body file 에 대한 링크가 포함된 목차를 생성시킨다. 

 

 

 


ODS HTML DESTINATION

1) BODY file

  • This is a required file that contains the outputobject(s) generated from the PROCs or DATA steps.
  •  Basically, this is where you store the results that will ultimately be displayed on your HTML report or
    web site.
  •  If your SAS job creates an output object that is routed to anHTML destination, ODS places the results within HTML <TABLE> tags,where they are stored as one or more HTML tables.
  •  If your SAS jobcreates a graphic object, the BODY file has an <IMG> (image) tag that
    references graphic output objects.
  •  Note that the BODY file can be specified with either the BODY= or the FILE= parameter.  

 

2) CONTENTS file

  • The CONTENTS file contains a link to each of the output objects that are stored in the BODY file, 
  • and is specified by the CONTENTS= parameter. 

 

3) FRAME file

  • Provides a simultaneous view of all files included in the ODS HTML statement. 
  • You specify the FRAME file with the FRAME = parameter. 

 

 

 

Q. The table of contents that was created by the CONTETNS=option contains a numbered heading for which of the following?

- a table of contents -

  • each procedure that creates output
  • The table of contents contains a numbered heading for each procedure that creates output.
  • 목차에는 출력을 생성하는 각 프로시저에 대한 번호가 지정된 제목이 포함되어 있다.

 

출처 :&nbsp;https://www.lexjansen.com/nesug/nesug03/ps/ps020.pdf

 

   1. ~ : procedure heading  ,  Cross~ : link to BODY file

 

 

[ 틀린 보기 ]

  • each procedure
  • each procedure and DATA step
  • each HTML file created by your program

 

 

 

 

 

 

Q. When the following code runs, what will the file D:\Output\frame.html display?

- FRAME = option - 

 

       ods html body = 'D:\output\body.html'

       contents = 'D:\output.contents.html'

       frame = 'D:\output.frame.html' ;

 

 

  • The files D:\Output\body.html and D:\Output\contents.html
  • The FRAME = option creates an HTML file that integrates the table of contents and the body file.

 

 

 

 

 

Q. What is the purpose of the following URL = suboptions?

- ★ URL = suboptions - 

 

        ods html  body = 'D:\output\body.html'    (url='body.html')

                contents = 'D:\output\contents.html'    (url='contents.html')       -------------→  simple URL

                frame = 'D:\output\frame.html' ; 

 

  • To create relative link addresses for loading the files from a server.
  • Specifying the URL = suboption in the file specification provides a URL that ODS uses in the links that is creates.
  • Specifying a simple (one name) URL creates a relative link address to the file.
  • 파일에 대한 relative link address 가 생성된다.

 

 

[ 틀린 보기 ]

  • To create absolute link addresses for loading the files from a server.
  • To allow HTML files to be loaded from a local drive.
  • to send HTML output to two locations.

 

 


The URL = Suboption

BODY, CONTETNS 파일 지정 안에 있는 URL 옵션을 지정함으로써 파일을 만든 모든 링크 안에서 ODS가 사용한 URL 을 제공할 수 있다.

 

General form, URL = suboption in a file specification :

(URL = 'Uniform-Resource-Locator')

 

  • Where Uniform-Resource-Locator is the name of as HTML file or the full URL of an HTML file.
  • ODS uses this URL instead of the filename in all the links and references that it creates that point to the file.
  • The URL=suboption is useful for building HTML files that can be moved from one location to another.
  • If the links from the contents and page files are constructed with a simple URL (one name)
  • they work as long as the contents, page, and body files are all in the same location.

 

 

Example : Relative URLs

          ods html body = 'c:\records\data.html'    (url='data.html')

               contents = 'c:\records\toc.html'    (url='toc.html)

               frame = 'c:\records\frame.html'  ;

 

  • In this ODS HTML statement, the URL=suboption specifies only the HTML filename.
  • This is the most commen style of linking between files because maintenace is easier and the files can be moved as long as they all remain the same directory or storage location.
  • HTML 파일 이름만 지정할 경우 Relative URL 이라 하며 파일들 사이를 연결하는 가장 일반적인 방법,
  • 유지하기 더 쉽고 같은 디렉토리 또는 저장위치 안에 모두 유지되어 있는 한 파일들을 이동할 수 있기 때문임

 

 

Example : Absolute URLs

          ods html body = 'c:\records\data.html'   

                          (url ='http://mysite.com/myreports/data.html')

                      contents = 'c:\records\toc.html'    

                        (url ='http://mysite.com/mycontents/toc.html')

                      frame = 'c:\records\frame.html'  ;

 

 

  • Alternatively, in this ODS HTML statement, the URL=suboptions specify complete URLs by using HyperText Transfer Protocol (HTTP)
  • These files can be stored in the same or different lacations.
  • HTTP 를 사용하여 완전한 URL 을 지정할 경우 Absolute URL 이 파일들은 동일한 혹은 다른 위치에 저장될 수 있다.

 

 

 

 


 

 

 

Q. Which ODS HTML option was used in creating the following table?

- ODS HTML statement 에서 STYLE = option  -

  • style = MeadowPrinter
  • You can chage the appearance of HTML output by using STYLE = option in the ODS HTML statement.
  • The style name does not need quotation marks.
  • ODS HTML 문안에 STYLE = option 을 이용하여 HTML 의 스타일을 바꿀 수 있다 !!
  • 스타일 이름은 quotation mark 가 필요없음 !! 

 

 

 

 

 

 

Q. What is the purpose of the PATH = option?

- PATH = option -

 

ods html path 'd:\output'   (url=none)

body = 'body.html'

contents = 'contents.html'

frame = 'frame.html' ; 

 

 

  • It specifies the location of HTML file output
  • You use the PATH=option to specify the location for HTML files to be stored.
  • When you use the PATH=option, you do not need to specify the full path name for the body,contents,frame files.
  • PATH = option 을 이용하여 HTML 출력 결과를 저장할 위치를 지정할 수 있다.
  • PATH = option 을 이용하여 저장될 HTML file 의 위치를 지정했다면 body,contents,frame 파일들에 full path name 을 적을 필요가 없다 !! 

  

 

[ 틀린보기 ]

  • It creates absolute link addresses for loading HTML files from a server.
  • it creates relative link addresses for loading HYML files from a server.
  • It allows HTML files to be loaded frim a local drive.