Date: Tue, 9 Mar 1999 16:07:49 +0100
Reply-To: Bas Pruijn <b.c.pruijn@PTT-POST.NL>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Bas Pruijn <b.c.pruijn@PTT-POST.NL>
Subject: Re: Help with character to numeric conversion.
Content-Type: text/plain; charset="iso-8859-1"
This code should generate 2 datasets: lastrecd and trailer
data lastrecd (drop=istrec) trailer (keep=istrec);
set datafile end=last;
output lastrecd;
if last then
do;
istrec = _n_;
format istrec z6.;
output trailer;
end;
run;
-----Original Message-----
From: Stephen Dybas <skd02@HEALTH.STATE.NY.US>
To: SAS-L@AKH-WIEN.AC.AT <SAS-L@AKH-WIEN.AC.AT>
Date: Tuesday, March 09, 1999 15:59
Subject: Help with character to numeric conversion.
>To SAS-L:
>
>I hope someone can help.
>
>I need to be able to print the number of records I am transmitting on a
>trailer record.
>
>I've tried a number of different ways to get the macro variable 'lstrec'
>converted to a nummeric
>that can be formatted with the zw. format but it always seems to come up
>missing.
>
>Here is the stripped down code...
>
>data lastrecd;
>set datafile end=last; /* Assume datafile is not empty */
>
>if last then do;
> lastrec = input(_n_, $char6.);
> call symput('lstrec', lastrec);
> end;
>
>run;
>
>data trailer;
>chrcount = symget('lstrec');
>numcount = ??? /* Need to convert character variable 'chrcount' */
> /* to a numeric variable 'numcount' /*
>run;
>
>
>data _null_;
>file outfile;
>set trailer;
>put @1 numcount z6.; /* So that I can put the numeric value to an */
> /* output file in zw. format */
>run;
>
>Thanks in advance for your help.
|