Date: Thu, 11 Apr 2002 16:23:13 -0400
Reply-To: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
Subject: Re: recoding of data
Content-Type: text/plain; charset=iso-8859-1
Sebastien,
If you need to create a SAS data file, you can do this:
data a ;
infile <...your file...> ;
input @ 41 courseno $char11. @ ;
if courseno ne '' then do until ( marker = '99999999') ;
input @ 01 marker $char8. @ 12 stuff $char18. ;
if marker = '' then output ;
end ;
drop marker ;
run ;
If you need an output text file with the layout you specified, you can do
this:
data _null_ ;
infile <... your input file ...> ;
input @ 41 courseno $char11. @ ;
file <... your output file ...> ;
if courseno ne '' then do until ( marker = '99999999') ;
input @ 01 marker $char8. @ 12 stuff $char18. ;
if marker = '' then put courseno stuff ;
end ;
run ;
Kind regards,
=====================
Paul M. Dorfman
Jacksonville, FL
=====================
> -----Original Message-----
> From: Sebastien Dube [mailto:Sebastien.Dube@MCGILL.CA]
> Sent: Thursday, April 11, 2002 3:19 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: recoding of data
>
>
> Dear all,
> I am trying to recode data and would need some hints.
>
> The input files look like this:
>
> [...]
> 018001 Professor X 176-134A-01 VECTORIAL ALG.
> 535245 34555554234
> 544124333445541443
> 535145 55555553335
> 535145445555541444
> 99999999
> [...]
>
> The first line refers to a course (176-134A-01) given by Prof X., then
> you have the individual answers (one record per student). The 99999999
> indicates the end of the "block" for this course. These "blocks" are
> repeated with variable length, however, the alignment of the
> information
> is always the same (e.g. the course number is always from col
> 41-67).
>
> I am trying to have the course number (176-134A-01) at the
> beginning of
> each record...like this:
>
> 176-134A-01 535245 34555554234
> 176-134A-01 544124333445541443
> 176-134A-01 535145 55555553335
> 176-134A-01 535145445555541444
>
> (without the first and last line of the block). Is this manipulation
> easy to do with SAS?
>
> All comments are welcome. Many Thanks
>
>
> ---------------------------------------------
> Sebastien Dube
> McGill University
>
>
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.
|