|
Hi Charles,
From the online doc:
=========
& [in an INPUT statement] indicates that a character value may have one or more single embedded blanks. This format modifier reads the value from the next nonblank column until the pointer reaches two consecutive blanks, the defined length of the variable, or the end of the input line, whichever comes first.
Restriction: The & modifier must follow the variable name and $ sign that it affects.
Tip: If you specify an informat after the & modifier, the terminating condition for the format modifier remains two blanks.
See: Modified List Input
Featured in: Reading Character Data That Contain Embedded Blanks
=========
't Was new to me as well, never used it, but possibly new in vs. 8.02 (don't have vs. 6.12 anymore to compare).
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: Charles Patridge [mailto:charles_s_patridge@PRODIGY.NET]
Sent: Friday, October 31, 2003 14:03
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: a question about & sign in SAS programming
Raymond,
I am not sure what the "&" does in your input statement - never tried to
use an "&" before as part of an input.
However, I think what you are looking for is the following - HTH -
I used the "$char" informat to read your embedded blanks for Subject
DATA study;
INFILE cards missover ;
INPUT NAME $ year SUBJECT $char15.;
cards;
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
;;;;
run;
proc print;
RUN;
|