CSULB_STAT475_handout14

CSULB_STAT475_handout14 - STAT 475 Chapter 16 PROCESSING...

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

View Full Document Right Arrow Icon
STAT 475 Chapter 16 PROCESSING VARIABLES WITH ARRAYS CREATING ONE-DIMENSIONAL ARRAYS A SAS array is a temporary grouping of variables under a single name. An array exists only for the duration of the DATA step. Usage of the ARRAY statement reduces the number of statements that are required for processing variables. By grouping variables into a one-dimensional array, it is possible to process all these variables in a single DO loop. The syntax is data newdataset_name ; set dataset_name ; array array_name { dimension } variable1 variable2 …; do index_variable =1 to dimension ; variable_name { index_variable }= expression(array_name{index_variable} ) ; end; run; The dimension specifies the number of elements variable1, variable2 , etc. in the array called array_name . The dimension may be enclosed in either parentheses, braces, or brackets array days(4) mon tue wed thr; or array days{4} mon tue wed thr; or array days[4] mon tue wed thr; Specifying the dimension of an array by an asterisk (*) instructs SAS to determine the dimension by counting the number of elements. array x{*} total1 total5 total6 total18; To compute the number of elements in an array, use the DIM function. DIM( array_name ) may be used as the stop value for the index_variable in a DO loop.
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
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