SAS-Export - SAS Export SAS Last Updated 29 June 2004...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
SAS Export SAS Export Last Updated : 29 June, 2004 Center of Excellence Data Warehousing
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Objectives   Write  observations  from  a  SAS  data  set  to  a  comma-delimited external file.  Use DATA step logic to insert a header record and  a footer record into an external file.
Image of page 2
Introduction You can use the DATA step to write a custom report data to an external file to be read by other programming  languages or software.
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Introduction The INPUT statement describes the arrangement of values in the input data record. The INFILE statement identifies an external file to read with an INPUT statement. The DATA statement begins the DATA step. READING FROM AN EXTERNAL FILE The PUT statement describes the arrangement of values in the output data record. The FILE statement identifies an external file to write with a PUT statement. The DATA statement begins the DATA step. WRITING TO AN EXTERNAL FILE
Image of page 4
The DATA Statement Usually, the DATA statement specifies at least one  data set name that the SAS System uses to create  an output data set.  Using the keyword _NULL_ as the data set name  causes  SAS  to  execute  the  DATA  step  without  writing observations to a data set. DATA _NULL_;
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The FILE Statement The  FILE  statement  can  be  used  to  specify  the  output  destination  for  subsequent  PUT  statements. General form of the FILE statement: You  can  use  the  FILE  statement  in  conditional  processing (IF-THEN/ELSE or SELECT) because it  is executable. FILE file-specification < options >;
Image of page 6
The PUT Statement The PUT statement can write lines to the external  file that is specified in the most recently executed  FILE statement. General form of the PUT statement: With simple list output, you list the names of the  variables whose values you want written. The PUT  statement writes a variable value, inserts a single  blank, and then writes the next value.  PUT variable-1 variable-2 … variable-n ;
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Modified List Output Modified list output increases the versatility of the  PUT  statement  because  you  can  specify  a  SAS  format  to  control  how  the  variable  values  are  written. To  use  modified  list  output,  use  the  colon  (:)  format modifier in the PUT statement between the  variable name and the format.  PUT variable-1 : format-1. variable-2 : format-2. variable-n : format-n. ; . . .
Image of page 8
Writing to an External File The prog2.maysales data set contains information  about houses. Read this data set and write the  data to an external file.
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern