LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2003, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 31 Oct 2003 10:02:46 +0100
Reply-To:   "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Subject:   Re: a question about & sign in SAS programming
Comments:   To: Raymond <ray6060@HOTMAIL.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Hi Raymond,

You define a variable Subject with a length of 15. If the first observation is read, the actual length of the subject is shorter, the end-of-line directly follows the Subject. Thus SAS default tries to read the complete field from the following line (FLOWOVER). Add the option TRUNCOVER to the INFILE statement and consult your doc, why that is necessary in this case. Also try switching «&» and «$15.» in your INPUT statement, see your doc on List Input.

Regards - Jim. -- . . . . . . . . . . . . . . . .

Jim Groeneveld, MSc. Biostatistician Science Team Vitatron B.V. Meander 1051 6825 MJ Arnhem Tel: +31/0 26 376 7365 Fax: +31/0 26 376 7305 Jim.Groeneveld@Vitatron.com www.vitatron.com

My computer has the solutions, I have the problems.

[common disclaimer]

-----Original Message----- From: Raymond [mailto:ray6060@HOTMAIL.COM] Sent: Friday, October 31, 2003 05:42 To: SAS-L@LISTSERV.UGA.EDU Subject: a question about & sign in SAS programming

The original dataset p3.dat is as follows:

BARBARA 2 ENGLISH CAROL 2 SCIENCE CAROL 3 ENGLISH CAROL 4 MATH DONALD 1 ART JAMES 4 MATH JOYCE 5 HOME ECONOMICS JOYCE 6 SCIENCE MARY 2 MECHANICS PHILIP 1 HOME ECONOMICS PHILIP 3 MATH WILLIAM 2 SCIENCE

SAS codes:

DATA study; INFILE 'p3.DAT'; INPUT NAME $ year SUBJECT & $15.; proc print; RUN;

Since there is imbedded blanks in the values of variable SUBJECT, so & sign should be used to avoid messed output. when & sign is taken off, the output is as follows, Obs NAME YEAR SUBJECT

1 BARBARA 2 CAROL 2 SCI 2 CAROL 3 CAROL 4 MAT 3 DONALD 1 JAMES 4 MAT 4 JOYCE 5 HOME ECONOMICS 5 JOYCE 6 MARY 2 MEC 6 PHILIP 1 HOME ECONOMICS 7 PHILIP 3 WILLIAM 2 SCI

Why is this? Since the imbedded blank occurs from the 7th record in the original dataset, why the first value of SUBJECT--ENGLISH is not read at all?

How does SAS pointer move in this situation?


Back to: Top of message | Previous page | Main SAS-L page