Help using Base SAS procedures

Regarding reading data

Reply
Contributor
Posts: 66

Regarding reading data

The data is in Text.how can i read

1 x 22
2a 33
3 aaa 44
4 bbb 55
id name age
5 ccc 66
6 ddd 55
7 eee 66
8 fff 77
id name age
9 ggg 99
10 hhh 88
11 rrr 87
12 eee 88


Hi i am having a data set in this every fifth observation is my variable name now i wnat to elimnate all the variable names in the obs and in starting varaiables name shd reflect.And i dont know the no of observations are there

output

id name$ age
1 x 22
2a 33
3 aaa 44
4 bbb 55
5 ccc 66
6 ddd 55
7 eee 66
8 fff 77
9 ggg 99
10 hhh 88
11 rrr 87
12 eee 88
Super Contributor
Super Contributor
Posts: 3,174

Re: Regarding reading data

A DATA step can be used here and test the input record buffer for some unreasonable value then DELETE the current record.

DATA ;
INFILE ;
INPUT @;
IF UPCASE(_INFILE_) =: 'ID' THEN DELETE;
* your DATA step code goes here to read your input file as expected. ;
RUN;

SAS support website http://support.sas.com/ can provide SAS-hosted documentation and technical/conference topic papers:

http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000146932.htm

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 93 views
  • 0 likes
  • 2 in conversation