/* SAS Example 1b: Entering "awkward" data */ OPTIONS PS=52; OPTIONS LS=78; OPTIONS NODATE; OPTIONS PAGENO=1; DATA TELEPHONE; INPUT NAME $4-23 ADDRESS $25-48 ZIP PHONE $56-67; /* This time our data is not going to be imported from a file, but instead we are going to include it in the program. We are also going to have a more complicated data structure, with multiple word character variables. */ /* Any time we wish to record alphanumeric data for a variable, we must follow up that variable name with a $ symbol in the input statement. This will often be sufficient, however we have the additional problem that when we enter a name for the first variable, we need to make SAS record the full name and not move onto the next variable after the first space. If we wish to enter multiple words as one variable, we need to tell SAS to take all characters over a range as that particular variable (here we are saying all letters in columns 4-23 should be taken as belonging to the name variable. This is only needed for multiple word variables. */ CARDS; Aadelvand, Steffanee 181 Wilkerson St, Ath 30601 706 425 9123 Aamoth, Daniel J 130 Woodbine Dr, Wtknsvl . 706 769 5450 Aanerud, Chris 1005 Macon Hwy, Ath 30606 706 552 3263 Aanerud, Roy L 1020 Hill Crk Ct 30677 706 769 8738 Aaron, Andy 149 Jefferson Rd, Sthm 30666 770 725 2334 ; RUN; /* The CARDS statement just tells the computer that the data is following. We list the data without any ; symbols, but then put one in right at the end. We also need to represent any missing data with a "." symbol. Otherwise the phone number of person 2 would have been placed in the zipcode column, since SAS would have kept on reading until it found something. This would have thrown the alignment off for the rest of the data entry. */ PROC PRINT DATA=TELEPHONE NOOBS; TITLE 'Telephone Number Data'; VAR NAME PHONE ADDRESS ZIP; RUN; /* The NOOBS option requests that observation numbers are not printed on the output, something else that makes the output tidier. */