Date: Tue, 7 Mar 2000 14:37:37 +0100
Reply-To: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject: Re: X -> "X"
Content-Type: text/plain; charset="iso-8859-1"
So, that's why! But that can be done directly without "changing" the
variable type and adding surrounding quotes. Just write out numerical values
using the PUT statement and an appropriate format and add explicit literal
quotes, like (for one numeric variable):
PUT '"' NumVar NumFmt. '"'; * and whatever you want more;
However, glad to hear you do have a useful solution anyway.
Regards - Jim.
Y. Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statistician, P.O. Box 1 fax. +31 412 407 080
head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO
J.Groeneveld@ITGroups.com the Netherlands in clinical research
My computer seems more ²°°°-compatible than I am myself.
> -----Original Message-----
> From: HALIMI Raphaėl [SMTP:Raphael.HALIMI@GEP.FR]
> Sent: Tuesday, March 07, 2000 1:54 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: X -> "X"
> I would like to thank Peter, Jim, Girish and Erik for their precious help.
> I was doing what you proposed in my program (using dummy variables + DROP
> RENAME)... even if I had a useless FORMAT syntax. What I retain from this
> discussion is that you can't directly change the type of a variable.
> Peter Crawford asked "why" -> I need to export into an ASCII file a
> with some proper formats (notably : quoted strings for)... Then I apply
> CN algorithm onto this file (it's a rule-induction program).
> Thanks again,
> > ----------
> > De : Jim Groeneveld[SMTP:J.Groeneveld@ITGROUPS.COM]
> > Répondre ą : Jim Groeneveld
> > Date : mardi 7 mars 2000 09:11
> > A : SAS-L@LISTSERV.UGA.EDU
> > Objet : Re: X -> "X"
> > Hello world,
> > gspatel@PEPCO.COM suggested a program to do the job for HALIMI Raphaėl.
> > Erik S. Larsen suggested to make it all one data step.
> > Some other improvements could be made, resulting in the *tested* program
> > below.
> > Note that RETAIN X ; LENGTH X $1.; X='"'; could be replaced by
> > RETAIN X '"';
> > but that construct has completely been removed in the following program.
> > DATA A (RENAME=(XX1=X1 XX2=X2 XX3=X3));
> > INPUT X1 X2 X3 ;
> > XX1= COMPRESS('"'||LEFT(PUT(X1,BEST.))||'"');
> > XX2= COMPRESS('"'||LEFT(PUT(X2,BEST.))||'"');
> > XX3= COMPRESS('"'||LEFT(PUT(X3,BEST.))||'"');
> > DROP X1 X2 X3 ;
> > CARDS;
> > 2.12 12.1 2
> > 4 2.4 21
> > 1 0.3 3.2
> > ;
> > RUN;
> > PROC PRINT DATA=A;
> > RUN;
> > But, as Peter Crawford asked, WHY?
> > Regards - Jim.
> > --
> > Y. Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
> > senior statistician, P.O. Box 1 fax. +31 412 407 080
> > head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO
> > J.Groeneveld@ITGroups.com the Netherlands in clinical research
> > My computer seems more ²°°°-compatible than I am myself.