Notes3 - e.t.c. Save your file in: Flash disk (USB),...

Info iconThis 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 )
Background image of page 1

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

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

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

View Full DocumentRight Arrow Icon
(3) Infile statement Data OwnChoice ; Infile ; Input ; label ……………. ; /* if necessary */ Run;
Background 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)
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background 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

Page1 / 7

Notes3 - e.t.c. Save your file in: Flash disk (USB),...

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

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