{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Notes3 - e.t.c • Save your file in Flash disk(USB desktop...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Reading data into SAS You can manually ‘ type in’ your data OR Copy and paste’ your data on the raw data section. SAS can read data from an external file in these formats: .txt, .prn, .dat, .csv, .xls, .xlsx e.t.c We will look at Infile statement and How to Import data ( proc import )
Image of page 1

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

View Full Document Right Arrow Icon
(1) Type it in! Data OwnChoice ; Input … … … … … … … ... ; label …………… ; /* if necessary */ Datalines; Run; Type your data in here
Image of page 2
(2)Copy and paste Data OwnChoice ; Input … … … … … … … ... ; label …………… ; /* if necessary */ Datalines; Run; Paste your data here
Image of page 3

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

View Full Document Right Arrow Icon
(3) Infile statement Data OwnChoice ; Infile ; Input ; label ……………. ; /* if necessary */ Run;
Image of page 4
Save your file Most data are stored in excel files. You can save your excel file as: .txt (Tab delimited ) .csv ( Comma delimited) .prn (Formatted text) .dat (ASCII-formatted file)
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: e.t.c. • Save your file in: Flash disk (USB), desktop, ‘documents’, CD e.t.c. Infile. . • In the infile statement you need to state the location of your file. (path). This can be obtained by: Right click on file > properties > location (example) Infile “C :\Users\Richard\Desktop\Datasets\ Grades.txt” location Name of my file Infile cont… Infile " " C:\Users\Richard\Desktop\Datasets\ Grades.prn ” firstobs = n ; /* default = 1 */ Infile " " C:\Users\Richard\Desktop\Datasets\ Grades.dat “ firstobs = n ; infile " C:\Users\Richard\Desktop\Datasets\ Grades.txt " DLM='09'x DSD firstobs = n ; where n = 1, 2, …. • firstobs is optional ! • If you want SAS to start reading your data from row 7, say, then firstobs = 7 • If firstobs is not included, SAS will automatically read your data from row 1( i.e. default = 1)....
View Full Document

{[ snackBarMessage ]}