Date: Wed, 9 Nov 2005 11:06:31 -0800
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Importing tagged data
In-Reply-To: <dktg64$t81$1@news.ox.ac.uk>
Content-Type: text/plain; charset="iso-8859-1"
You can use TRANWRD to change 10index to index10 a SAS name.
Or you can use the @'quoted string' pointer control. I will post an
example using that method with your current example data in a bit.
Can you provide a more complete example of the input? Sounds like you
may need to scan the data for the words on the left side of the equal
sign first then write some code based on the info obtained from that
step.
Just e-mail to me as it may be too long for posting to the new group.
data work.named;
infile cards;
attrib sex length=$4 informat=$4.;
attrib feature length=$3 informat=$3.;
attrib feature2 length=$3 informat=$3.;
attrib postcode length=8 informat=f4.;
attrib index10 length=8;
input @;
_infile_ = translate(_infile_,' ','#');
_infile_ = tranwrd(_infile_,'10index=','index10=');
input (sex feature feature2 postcode index10) (=);
cards;
sex=male#feature=yes#postcode=2132#10index=1
sex=fem#feature2=no#postcode=3472#10index=2
;;;;
run;
proc print;
run;
|