View Full Version : SAS input


anna_s
01-04-2009, 10:29 AM
I have a large file that needs to be read into SAS. It is comma delimited and I have no problem with that. However some of the columns are not comma delimited and need to be. For example:

The format the data is in:

Grey,Type4,67,98,78987678

The format it should be:
Grey,Type4,67,98,78,98,76,78

Is there an easy way to read the data in properly? Just importing it as a comma delimited file makes it impossible to read the last values correctly.

Thanks

recheleb
01-05-2009, 02:26 PM
Did you ever get your answer?

You would need to specify column locations. A book by Paul E. Spector, "SAS Programming for Researchers and Social Scientists" has examples.

You would have to type a very specific input line into your SAS program.

Example
Color $1-4 Var2 $6-11 Var3 12-13 etc.

It only works if your variables all have the same number of characters. You use a $ notation for text variables. You assign numbers to the 'columns' by counting the number of characters across the line.

Good luck with your file!

anna_s
01-11-2009, 01:40 PM
Thanks. I was just hoping that there was a shorter way. If I bring these long strings as a character variable, is there a quicker way to "break" them up? This data set is huge (in terms of variables) and typing this input statement will be extremely time consuming.