Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SAS Oddities

SAS Oddities/Input issues by mycotropic
Posted: 19 Sep 02

Thought I would share this little incredibly irritating tidbit;
data one;
     infile in1 delimiter=',' truncover dsd lrecl=13;
     input visitnumber $ flights blocks ;

label  flights = 'Flights per day';
       blocks  = 'Blocks per day';
Ok - When you are reading in comma delimited text of varying width AND you are being efficient and including a label statement to help your users, (This is the irritating part) and when you accidentaly use that extra ';' after the first label statement - SAS reads in the comma delimited file just fine, it then hits the 'flights' label and creates the label - SAS then begins feeding you "invalid numeric data" for your 'blocks' variable. A subsequent Proc Print will show the first two variables as having values and the third variable with no values.

Believe me when I say that you and your cooworkers can stare at the code for quite some time without realizing what that inapropriate ';' is doing to your data.

The correct code is obviously;
data one;
     infile in1 delimiter=',' truncover dsd lrecl=13;
     input visitnumber $ flights blocks ;

label  flights = 'Flights per day'
       blocks  = 'Blocks per day';
Sans the first ';' and all is well, three variables with two labels all with values, rather then three variables with values and one with no data.

Back to SAS Institute, Inc. solutions FAQ Index
Back to SAS Institute, Inc. solutions Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close