Architecting, installing and maintaining your SAS environment

Data Reading Eror

Reply
Contributor
Posts: 71

Data Reading Eror

HI All,

I have an issue when reading data

This is my data file

Name,sal,comm

venkat srini,1000 ,300

srinivas,kiran,raju,3000,150

When I import into sas the data is reading as

Name sal comm

venkat srini 1000 300

srinivas kiran raju

Can you let me know solution. My data is 28gb. can any one let me know solution for this issue.

regards,

venky

Super User
Posts: 5,426

Re: Data Reading Eror

It's a large file for not having a proper lay-out...

In row 2, does it mean three persons, or just one person with three names?

If possible, get back to your supplier and have the generate file with a better structure.

Data never sleeps
Contributor
Posts: 71

Re: Data Reading Eror

Its one person with 3 names

Regular Contributor
Posts: 151

Re: Data Reading Eror

length dlm $1;

dlm = ',';

infile cards dsd dlm=dlm;

informat name $30. sal 8. comm 8.;

input @;

call scan(_infile_,-2,end,_n_,',');

length = end-1-1;

input name $varying30. length +1 sal comm;

keep name sal comm;

cards;

venkat srini,1000 ,300

srinivas,kiran,raju,3000,150

;

Contributor
Posts: 71

Re: Data Reading Eror

Thanks for the work. Can you explain me the steps I unable to figure out.

Regular Contributor
Posts: 151

Re: Data Reading Eror

length = end-1-1; -> the length of the string that we are reading into variable name.

Hope this helps.

Oleg.

Super User
Posts: 5,426

Re: Data Reading Eror

Neat solution.

But if the real data is more complex (have more columns), it could require some extensive programming.

So from an architectural perspective, it would still be better to require a different file lay-out (fixed width, or char columns enclosed by <">).

Data never sleeps
Regular Contributor
Posts: 151

Re: Data Reading Eror

I take this solution from the post of DN  (Data _null_). See the link above.

Regular Contributor
Posts: 151

Re: Data Reading Eror

Ask a Question
Discussion stats
  • 8 replies
  • 531 views
  • 1 like
  • 3 in conversation