Date: Wed, 8 Sep 2004 10:48:39 -0400
Reply-To: Lou <lpogodajr292185@COMCAST.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogodajr292185@COMCAST.NET>
Subject: Re: Out, out damned space character!
The SAS editor, and the FS (Full Screen) suite of applications was
introduced with version 5 - about 20 years ago, if my memory serves me.
There's nothing _wrong_ with using some other software (though I'd choose
KEdit over UltraEdit), it's just not necessary. It's well worth while
spending a little time with the manual (what a foreign concept that seems to
be these days - read the instructions) to become at least aware of the
possibilities and capabilities of the system.
"Pardee, Roy" <pardee.r@GHC.ORG> wrote in message
news:C93AE4021921784ABAE89216FF4C371805B08A41@ROC2T7.ghc.org...
> Hey I'm not averse to using SAS--far from it! But it's hard to beat
> right-clicking on the dset, choosing 'ultraedit' off the context menu,
> and scrolling down to where the data start.
>
> I never actually learned to use the SAS editor, believe it or not. What
> version was that introduced, anyway? I wonder if I can plausibly claim
> to have learned SAS before it had an "IDE"...
>
> Cheers,
>
> -Roy
>
> -----Original Message-----
> From: Choate, Paul@DDS [mailto:pchoate@DDS.CA.GOV]
> Sent: Tuesday, September 07, 2004 4:16 PM
> To: Pardee, Roy; SAS-L@LISTSERV.UGA.EDU
> Subject: RE: Out, out damned space character!
>
>
> Hi Roy -
> I have to side with Toby, why not use SAS? Six short lines to find out
> the problem, six short lines to fix it!
> 449 data _null_;
> 450 infile 'test.txt' recfm=n;
> 451 input byte $char1. @;
> 452 position+1;
> 453 hexbyte=put(byte,$hex2.);
> 454 put (_all_) (= );
> 455 run;
> NOTE: UNBUFFERED is the default with RECFM=N.
> NOTE: The infile 'test.txt' is:
> File Name=C:\Documents and Settings\pchoate\Desktop\test.txt,
> RECFM=N,LRECL=256
> byte=a position=1 hexbyte=61
> byte=s position=2 hexbyte=73
> byte=c position=3 hexbyte=63
> byte=i position=4 hexbyte=69
> byte=i position=5 hexbyte=69
> byte=> position=6 hexbyte=3E
> byte=> position=7 hexbyte=3E
> byte= position=8 hexbyte=00
> byte=< position=9 hexbyte=3C
> byte=< position=10 hexbyte=3C
> byte=s position=11 hexbyte=73
> byte=p position=12 hexbyte=70
> byte=a position=13 hexbyte=61
> byte=c position=14 hexbyte=63
> byte=e position=15 hexbyte=65
> NOTE: DATA statement used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
> 456
> 457
> 458 data _null_;
> 459 infile 'Test.txt' recfm=n;
> 460 input byte $char1. @;
> 461 if byte='00'x then byte=' ';
> 462 file 'fixed.txt' recfm=n;
> 463 put byte $char1. @;
> 464 run;
> NOTE: UNBUFFERED is the default with RECFM=N.
> NOTE: The infile 'Test.txt' is:
> File Name=C:\Documents and Settings\pchoate\Desktop\Test.txt,
> RECFM=N,LRECL=256
> NOTE: UNBUFFERED is the default with RECFM=N.
> NOTE: The file 'fixed.txt' is:
> File Name=C:\Documents and Settings\pchoate\Desktop\fixed.txt,
> RECFM=N,LRECL=256
> NOTE: DATA statement used (Total process time):
> real time 0.01 seconds
> cpu time 0.00 seconds
>
>
> 465
> 466
> 467 data _null_;
> 468 infile 'fixed.txt' recfm=n;
> 469 input byte $char1. @;
> 470 position+1;
> 471 hexbyte=put(byte,$hex2.);
> 472 put (_all_) (= );
> 473 run;
> NOTE: UNBUFFERED is the default with RECFM=N.
> NOTE: The infile 'fixed.txt' is:
> File Name=C:\Documents and Settings\pchoate\Desktop\fixed.txt,
> RECFM=N,LRECL=256
> byte=a position=1 hexbyte=61
> byte=s position=2 hexbyte=73
> byte=c position=3 hexbyte=63
> byte=i position=4 hexbyte=69
> byte=i position=5 hexbyte=69
> byte=> position=6 hexbyte=3E
> byte=> position=7 hexbyte=3E
> byte= position=8 hexbyte=20
> byte=< position=9 hexbyte=3C
> byte=< position=10 hexbyte=3C
> byte=s position=11 hexbyte=73
> byte=p position=12 hexbyte=70
> byte=a position=13 hexbyte=61
> byte=c position=14 hexbyte=63
> byte=e position=15 hexbyte=65
> NOTE: DATA statement used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
> hth
>
>
> Paul Choate
> DDS Data Extraction
> (916) 654-2160
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Pardee, Roy
> Sent: Tuesday, September 07, 2004 1:03 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Out, out damned space character!
> No difference--alas!
> But a collegue helped me figure it out--these nasties are ASCII nulls,
> mixed in with spaces (for good measure). So *this* works:
> , '~' || compress(dx, '00'x || ' ') || '~' as genesidea
> And once again--hooray for ultraedit. We figured it out by looking at
> the sas7bdat in UE in hex mode.
> Thanks to all who responded!
> Cheers,
> -Roy
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Dunn, Toby
> Sent: Tuesday, September 07, 2004 12:44 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Out, out damned space character!
>
>
> Roy,
> Try compress('~' || dx || '~') as dxcomp
> HTH
> Toby Dunn
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Pardee, Roy
> Sent: Tuesday, September 07, 2004 2:38 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Out, out damned space character!
> Hey All,
> I've got a char var called dx & I'd like to trim it, but I can't seem to
>
> do it. This code:
> proc sql ;
> select vistnum
> , '~' || compress(dx, ' ') || '~' as dxcomp
> , '~' || compress(dx) || '~' as dxcomp2
> , '~' || trim(dx) || '~' as dxtrim
> , '~' || trimn(dx) || '~' as dxtrimn
> from crn.dx
> where VistNum le 10 ;
> quit ;
> Produces this output:
> VISTNUM dxcomp dxcomp2 dxtrim dxtrimn
> --------------------------------------------------------
> 7 ~784.0~ ~784.0~ ~784.0~ ~784.0~
> 8 ~ . ~ ~ . ~ ~ . ~ ~ . ~
> 8 ~428.0~ ~428.0~ ~428.0~ ~428.0~
> 9 ~ . ~ ~ . ~ ~ . ~ ~ . ~
> 9 ~786.50~ ~786.50~ ~786.50~ ~786.50~
> 10 ~333.81~ ~333.81~ ~333.81~ ~333.81~
> 10 ~366.10~ ~366.10~ ~366.10~ ~366.10~
> I'd like those two:
> ~ . ~
> To be instead:
> ~.~
> What manner of foul zombie characters are these, that refuse to be
> trimmed & compressed? And how can I get rid of them?
> Thanks!
> -Roy
> Roy Pardee
> Research Analyst/Programmer
> Center For Health Studies (Cancer Research Network)
> Group Health Cooperative
> (206) 287-2078
> This message and any attached files might contain confidential
> information protected by federal and state law. The information is
> intended only for the use of the individual(s) or entities originally
> named as addressees. The improper disclosure of such information may be
> subject to civil or criminal penalties. If this message reached you in
> error, please contact the sender and destroy this message. Disclosing,
> copying, forwarding, or distributing the information by unauthorized
> individuals or entities is strictly prohibited by law.
|