Date: Thu, 22 Feb 2001 13:22:24 -0600
Reply-To: aldi@wubios.wustl.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Aldi Kraja <aldi@WUBIOS.WUSTL.EDU>
Organization: Washington University
Subject: Re: Reading data:
Content-Type: text/plain; charset=us-ascii
Thank you Peter,
Your ideas are really helpful,
Aldi
Peter Crawford wrote:
> Aldi Kraja <aldi@wubios.wustl.edu> has a problem reading data in a
> posting to be found below the sig line
>
> This is a case where macros are not helping (IMHO).
> Reading any fixed structure should be simple for sas input statements.
> Most of the macro verbosity deals with the preference the macro
> environment has for eliminating leading zeros from a numeric suffix,
> in %do suffix = 1 %to 220;
> D0G&suffix
> %end;
> whereas
> length D0G001 - D0G220 $6;
> prepares all those variables,
> and reading this fixed structure is equally simple
> input ( pedid subject )($char5.) ( D0G001 - D0G220 )($char6.) ;
>
> IF missover is providing inconsistent behaviour,
> the cause might be revealed in MPRINT output.
> I always expect to use TRUNCOVER and/or SCANOVER rather than MISSOVER.
> In addition to the double @@ (only one line is ever read),
> another problem may be caused by the default LRECL.
> On a platform with physical names like
> >filename mark1 "/data/testmrk01.1";
> The default lrecl would be 256.
> As described, this data should be 1330 wide fixed.
> However the notes offered, suggest '/' delimited values, which may be
> input better with infile option DSD and DLM='/' .
> > File Size (bytes)=1992507
> 1992507 is 1497 records of 1330 bytes + 1
> linefeed byte on each record, suggests NO record buffering !!! ???
>
> I think there are too any problems with the macro based solution
> proposed, compared with a basic step like
> data justRead;
> infile 'x.data' lrecl = 1330 truncover;
> length D0G001 - D0G220 $6;
> input ( pedid subject )($char5.) ( D0G001 - D0G220 )($char6.) ;
> run;
>
> The macro handling varnames with difficulty continue into a step to
> compress() the D0Gnnn values. I can't guess why, but for simplicity, to
> that input step, just before the run statement, add the lines
> array d0g d0g: ; *define implicit array of all D0G* variables;
> do over d0g; d0g = compress( d0g ); end;
>
> In a data step, array handling can be simpler than macros ....
>
> Regards
> --
> Peter Crawford
--
|