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
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.
Its one person with 3 names
data a;
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
;
Thanks for the work. Can you explain me the steps I unable to figure out.
call scan(_infile_,-2,end,_n_,','); -> variable end is the beggining of the second (-2) word from the end of line delemited by comma.
length = end-1-1; -> the length of the string that we are reading into variable name.
Hope this helps.
Oleg.
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 <">).
I take this solution from the post of DN (Data _null_). See the link above.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.