SAS-Functions_Conversions

SAS-Functions_Conversions - SAS Functions SAS Last Updated...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

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

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

View Full DocumentRight Arrow Icon
Objectives  Review the syntax of SAS functions.
Background image of page 2
SAS Functions The  SAS  System  provides  a  large  library  of  functions for manipulating data during DATA step  execution. A SAS function is often categorized by the type of  data manipulation performed: truncation character date and time mathematical trigonometric special sample statistics arithmetic financial random number state and ZIP code.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Syntax for SAS Functions A  SAS  function  is  a  routine  that  performs  a computation or system manipulation and returns a value.  Functions  use  arguments  supplied  by  the user or by the operating environment.  General form of a SAS function: function-name ( argument-1 , argument-2 ,…, argument-n )
Background image of page 4
Using SAS Functions You  can  use  functions  in  executable  DATA  step  statements anywhere an expression can appear. data contrib; set prog2.donate; Total=sum(Qtr1,Qtr2,Qtr3,Qtr4); if Total ge 50; run; proc print data=contrib noobs; run;
Background image of page 5

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

View Full DocumentRight Arrow Icon
Using SAS Functions Partial Output What if you want to sum Qtr1 through Qtr400,  instead of Qtr1 through Qtr4? ID Qtr1 Qtr2 Qtr3 Qtr4 Total E00224 12 33 22 . 67 E00367 35 48 40 30 153 E00441 . 63 89 90 242 E00587 16 19 30 29 94 E00621 10 12 15 25 62
Background image of page 6
SAS Variable Lists A  SAS  variable  list  is  an  abbreviated  method  of  referring to a list of variable names. SAS enables  you to use the following variable lists: numbered range lists  name range lists  name prefix lists  special SAS name lists.
Background image of page 7

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

View Full DocumentRight Arrow Icon
SAS Variable Lists When  you  use  a  numbered  range  list  in  a  SAS  function,  use  the  keyword  OF  in  front  of  the  first  variable name in the list. Omitting  the  keyword  OF  causes  subtraction  to  occur. data contrib; set prog2.donate; Total=sum(of Qtr1-Qtr4); if Total ge 50; run;
Background image of page 8
Objectives Use SAS functions and operators to extract, edit, and  search character values.
Background image of page 9

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

View Full DocumentRight Arrow Icon
A Mailing Label Application The   prog2.freqfliers  data set contains  information about frequent fliers. Use this data set to  create another data set suitable for mailing labels.
Background image of page 10
A Mailing Label Application ID is a character variable. Its last digit represents  the gender (1 denotes female, 2 denotes male) of  the frequent flier. prog2.freqfliers ID Name Address1 Address2 F31351 Farr,Sue 15 Harvey Rd. Macon,Bibb,GA,31298 F161 Cox,Kay B. 163 McNeil Pl. Kern,Pond,CA,93280 F212 Mason,Ron 442 Glen Ave. Miami,Dade,FL,33054 F25122 Ruth,G. H. 2491 Brady St. Munger,Bay,MI,48747
Background image of page 11

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

View Full DocumentRight Arrow Icon
A Mailing Label Application labels The first task is to create a title of "Mr." or "Ms."  based on the last digit of ID. FullName
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/08/2010 for the course USE 3425 taught by Professor Raman during the Spring '10 term at Punjab Engineering College.

Page1 / 116

SAS-Functions_Conversions - SAS Functions SAS Last Updated...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online