lesson07 - Lesson 7 - Topics Permanent SAS datasets...

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

View Full Document Right Arrow Icon
Lesson 7 - Topics Permanent SAS datasets Sub-setting and merging SAS datasets Programs 11-14 in course notes C&S 13:H-J; 14:A-D LSB 2:19-21 3:7 6:1-2,4-5,9,11-13
Background image of page 1

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

View Full DocumentRight Arrow Icon
Temporary vs Permanent SAS Datasets Temporary (or work) SAS dataset - After SAS session is over the dataset is deleted. DATA bp; * bp is deleted after SAS session; (rest of program) Permanent SAS dataset - After program is run the dataset is saved and is available for use in future programs. You need to tell SAS where to store/retrieve the dataset. Note: For PC SAS the working dataset is available until you end the SAS session.
Background image of page 2
Reasons to Create Permanent SAS Datasets Read raw data and compute calculated variables only once All variables have assigned names and labels. Data is ready to be analyzed. Dataset can be sent to other computers or users.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Creating a Permanent SAS Dataset LIBNAME mylib ‘C:\My SAS Datasets’ ; DATA mylib .sescore; LIBNAME – assigns a directory (folder) reference name. In this example the directory ‘C:\My SAS Datasets’ is assigned a reference name of mylib . DATA mylib . sescore ; Tells SAS to create a dataset called sescore in the directory referenced by mylib, which is ‘C:\My SAS Datasets’.
Background image of page 4
Examples of LIBNAME Statements LIBNAME mylib ‘C:\My SAS Files' ; LIBNAME class ‘C:\My SAS Files' ; LIBNAME ph6420 'C:\My SAS Files\SASClass\' ; LIBNAME points to a directory (folder) DATA mylib. datasetname ; DATA class. datasetname ; DATA ph6420. datasetname ; On UNIX and PC the file will be called datasetname .sas7bdat
Background image of page 5

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

View Full DocumentRight Arrow Icon
PROGRAM 11 LIBNAME mylib ‘C:\SAS_Files' ; DATA mylib.sescore; INFILE ‘C:\SAS_Files\tomhs.data' LRECL = 400 ; INPUT @ 1 ptid $10. @ 12 clinic $1. @ 14 randdate mmddyy10. @ 25 group 1. @ 49 educ 1. @ 85 wtbl 5.1 @ 97 wt12 5.1 @ 115 sbpbl 3.0 @ 123 sbp12 3.0 @ 236 (sebl_1-sebl_20) ( 1. + 1 ) @ 276 (se12_1-se12_20) ( 1. + 1 ) ;
Background image of page 6
wtd12 = wt12 - wtbl; sbpd12 = sbp12 - sbpbl; sescrbl = MEAN (OF sebl_1 - sebl_20) ; sescr12 = MEAN (OF se12_1 - se12_20) ; sescrd12 = sescr12 - sescrbl ; LABEL educ = 'Highest Education Level' ; LABEL wt12 = 'Weight (lbs) at 12 Months' ; LABEL wtbl = 'Weight (lbs) at Baseline' ; LABEL wtd12 = 'Weight Change at Baseline' ; LABEL sbpbl = 'Systolic BP (mmHg) at Baseline' ; LABEL sbp12 = 'Systolic BP (mmHg) at 12 Months' ; LABEL sbpd12 = 'Systolic BP Change at 12 Months' ; LABEL group = 'Treatment Group (1-6)' ; LABEL sescrbl = 'Side Effect at Baseline' ; LABEL sescr12 = 'Side Effect at 12 Months' ; LABEL sescrd12 = 'Side Effect Change Score' ; FORMAT randdate mmddyy10. ; DROP sebl_1-sebl_20 se12_1-se12_20 ; Program 11
Background image of page 7

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

View Full DocumentRight Arrow Icon
60 LIBNAME mylib 'C:\SAS_Files'; NOTE: Libref MYLIB was successfully assigned as follows: Engine: V9 Physical Name: C:\SAS_Files DATA mylib.sescore;
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 30

lesson07 - Lesson 7 - Topics Permanent SAS datasets...

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

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