BookmarkSubscribeRSS Feed
pallis
Fluorite | Level 6

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

8 REPLIES 8
LinusH
Tourmaline | Level 20

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
pallis
Fluorite | Level 6

Its one person with 3 names

Oleg_L
Obsidian | Level 7

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

;

pallis
Fluorite | Level 6

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

Oleg_L
Obsidian | Level 7

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

Hope this helps.

Oleg.

LinusH
Tourmaline | Level 20

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
Oleg_L
Obsidian | Level 7

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

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1726 views
  • 1 like
  • 3 in conversation