【正文】
SAS Data Management SAS Workshop Hun Myoung Park, . University Information Technology Services Center for Statistical and Mathematical Computing Wednesday, November 10, 2021 169。 20212021 The Trustees of Indiana University (812) 8554740, (317) 2784740 November 10, 2021 SAS Data Management Outline ? INPUT Statement: Input Styles ? INFILE Statement ? PROC IMPORT/EXPORT ? Data Manipulation ? IF…ELSE amp。 DO…END Clauses ? Recode Variables ? LABEL and RENAME Variables ? Select Observations amp。 Variables ? Working with Data Sets University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management SAS DATA SOURCES University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management DATA STEP ? DATA steps read and manipulate data. ? INPUT tells how SAS reads data. ? DATALINES indicates data items to be read begin from the next line. ? INFILE reads data from an external file. LIBNAME sm ?c:\temp\sas?。 DATA 。 INPUT name $ id stat math。 DATALINES。 John 10091 89 95 … RUN。 University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management INPUT STATEMENT ? There are six input styles. 1. List INPUT: simply list variable names 2. Modified list INPUT: for illanized data 3. Column INPUT: location of data items 4. Formatted INPUT: format of data items 5. Named INPUT: variable=data 6. Mixed INPUT: bine input styles ? SAS recognizes styles automatically. ? List (previous slide), column, and formatted INPUT are monly used. University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management COLUMN INPUT ? Specify column locations of data items ? $ follows a character variable name ? Data should be aligned correctly ? Some data may be skipped (id below) DATA 。 INPUT name $ 16 stat 1214 math 1517。 DATALINES。 John 10091 89 95 Rachel10100 99 … RUN。 University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management FORMATTED INPUT ? Specify formats of data items. ? Data should be aligned correctly. ? $6. means a string 6 characters long. ? or 3. means a 3 digit number without a decimal point. DATA 。 INPUT name $6. id 5. male 3. stat 。 DATALINES。 John 10091 89 95 Rachel10100 99 … University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management COLUMN CONTROLS ? @n moves the input pointer to the nth column. ? +n shifts the input pointer by n column to the right. ? You may skip some variables (., id) INPUT name $6. +5 stat 3. @15 math 3.。 DATALINES。 John 10091 89 95 Rachel10100 99 … University Information Technology Services Center for Statistical and Mathematical Computing November 10, 2021 SAS Data Management LINE CONTROLS ? @ and @@ trailing hold input records INPUT name $ stat math @@。 DATALINES。 John 89 95 Ron 76 100 ? n moves the input pointer to nth line, / moves the input pointer to the next line INPUT name $6. 2 st