Sample 24692: Reading data using named input
Read datalines or records that contain a variable name followed
by an equal sign and the value.
Using named input does not require that all variables in the dataline
or record be read in. The variable order specified in the INPUT
statement does not have to match the order of the datalines or
records. Values in the dataline or record which are not preceded by
the variable name and equal sign can be read in using other styles of
input. However, once the INPUT statement starts to read with named
input, all remaining values must be read with named input.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
data deptinfo;
input dept $ last= $ first= $ start= $10.;
datalines;
acct start=15-01-2000 first=Mary last=Lowe
hr start=01-09-1984 first=Greg last=Richards
oper start=01-11-1990 first=Cindy last=Lou
oper start=15-05-1995 first=Julie last=Simpson
acct start=01-03-1999 first=Sam last=Hampton
;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
OBS DEPT LAST FIRST START
1 acct Lowe Mary 15-01-2000
2 hr Richards Greg 01-09-1984
3 oper Lou Cindy 01-11-1990
4 oper Simpson Julie 15-05-1995
5 acct Hampton Sam 01-03-1999
Read datalines or records that contain a variable
name followed by an equal sign and the value.
Type: | Sample |
Topic: | SAS Reference ==> DATA Step Common Programming Tasks ==> Reading and Writing External Data
|
Date Modified: | 2011-11-02 16:37:10 |
Date Created: | 2004-09-30 14:09:04 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |