LEARNING SAS BY EXAMPLE RON CODY PDF
“I wish that Ron Cody's new book, Learning SAS® by Example: A Programmer's Guide, in publishable formats such as RTF and PDF. §.sas. Learning SAS. ® by Example. Ron Cody. A Programmer's Guide. Second Edition ISBN (PDF). All Rights Reserved. Produced in the . Ron Cody. Learning SAS® by Example. A Programmer's Guide. SAS® Press .. 1 See Ron Cody and Jeffrey K. Smith, Applied Statistics and the Programming Language, 5th ed. (Englewood Cliffs, PDF output destination –
|Language:||English, Spanish, Japanese|
|ePub File Size:||30.70 MB|
|PDF File Size:||8.84 MB|
|Distribution:||Free* [*Regsitration Required]|
If you like learning by example, then Book Details Author: Ron Cody Pages: Binding: Paperback Brand: Brand: Book Appearances if you. Learning SAS® by Example: A Programmer's Guide Cody, Ron SAS Press, , xxviii + pages, € / US$ , softcover ISBN. Ron Cody: Learning SAS by Example: A. Programmer's Guide. PDF Download, MOBi EPUB Kindle. Description. Learn to program SAS.
Published on Mar 12, SlideShare Explore Search You. Submit Search. Successfully reported this slideshow. We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads.
You can change your ad preferences anytime. Upcoming SlideShare. Like this document? Why not share!
An annual anal Embed Size px. Start on.
Show related SlideShares at end. WordPress Shortcode.
KatieMitchelle Follow. Published in: Full Name Comment goes here.
Are you sure you want to Yes No. Be the first to like this. No Downloads. Views Total views.
Actions Shares. Embeds 0 No embeds.
Follow the author
No notes for slide. Learning SAS by Example: In the statements above, you are allowing missing values as valid codes. If you want to flag missing values as errors, do not include a missing value in the list of valid codes. A statement similar to the gender checking statement is used to test the adverse events. There are so many valid values for Dx any numeral from 1 to that the approach you used for Gender and AE would be inefficient and wear you out typing if you used it to check for invalid Dx codes.
The VERIFY function is one of the many possible ways you can check to see if there is a value other than the numerals 0 to 9 as a Dx value.
The value of Position in the line above would be 4, the position of the first invalid character in ID the letter B. You usually think of true and false values as 1 or 0—and that is what SAS returns to you when it evaluates an expression.
Cody's Data Cleaning Techniques Using SAS
However, it is often convenient to use values other than 1 to represent TRUE. Suppose you had an ID equal to 'X'. You might think the answer is 0 since you only see valid characters in the ID X, 1, 2, and 3. However, the expression above returns a 5!
Learning SAS by Example: A Programmer's Guide Preview
Because that is the position of the first trailing blank. Since ID is stored in 5 bytes, any ID with fewer than 5 characters will contain trailing blanks—and blanks, even though they are sometimes hard to see, are still considered characters to be tested by the VERIFY function. Therefore, the expression verify trim ID ,'XYZ' will return a 0 for all valid values of ID, even if they are shorter than 5 characters.
There is one more problem to solve. That is, the expression above will return a 1 for a missing value of ID. Think of character missing values as blanks. And, this function can take character or numeric arguments!
It makes your SAS programs much more readable. The verify string contained the characters numerals 0 through 9. This occurs because there is a duplicate observation for patient in addition to several other purposely included errors , so that the data set can be used for examples later in this book, such as the detection of duplicate ID's and duplicate observations.
However, you want to flag missing values as errors every patient must have a valid ID.
As with most of the topics in this book, you will see several ways of accomplishing the same task. One reason is that some techniques are better suited to an application. Another reason is to teach some additional SAS programming techniques.
Finally, under different circumstances, some techniques may be more efficient than others. However, the WHERE statement does require that all variables already exist in the data set being processed. The output from Program follows.
Listing of invalid gender values Patno gender X f 2 f This program can be extended to list invalid values for all the character variables. It lists all the patient numbers, genders, Dx codes, and adverse events even when only one of the variables has an error patient , for example. So, there is a trade-off—the simpler program produces slightly less desirable output.
We could get philosophical and extend this concept to life in general, but that's for some other book. Using Formats to Check for Invalid Values Another way to check for invalid values of a character variable from raw data is to use user-defined formats. There are several possibilities here.
One, you can create a format that leaves all valid character values as is and formats all invalid values to a single error code. Let's start out with a program that simply assigns formats to the character variables and uses PROC FREQ to list the number of valid and invalid codes. Program uses formats to convert all invalid data values to a single value. Format each of these values with the value 'Valid'. You may choose to combine the missing value with the valid values if that is appropriate, or you may want to keep track of missing values separately as was done here.
Finally, any value other than the valid values or a missing value will be formatted as 'Miscoded'. It doesn't tell you which observations patient numbers contain missing or invalid values. The result of a PUT function is always a character variable, and the function is frequently used to perform numeric-to-character conversions. In Program , the first argument of the PUT function is a character variable you want to test and the second argument is the corresponding character format.However, you want to flag missing values as errors every patient must have a valid ID.
For this exercise, you expect values of Gender to be 'F' or 'M', values of Dx the numerals 1 through , and values of AE adverse events to be '0' or '1'. Because that is the position of the first trailing blank. By specifying each value individually, the lowercase 'f' the only lowercase GENDER value would match the range 'F' and be assigned the value of an uppercase 'F'. Therefore, place a NOT in front of the whole expression, triggering the error report for invalid values of Gender or AE.
Please check your email for instructions on resetting your password.