LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Sep 2006 11:58:22 -0700
Reply-To:     "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject:      Re: Question about PUT numeric into character in PROC SQL
Comments: To: Yongshan Lin <yongshan.lin@GMAIL.COM>
Content-Type: text/plain; charset="us-ascii"


As your error message indicates, you should not use the $ in the format, for either datastep or SQL.

proc sql; create table test2 as select put(age,3.) as newvar from sashelp.class; quit;

data test3; set sashelp.class; newvar = put(age,3.); run;

* this will get a WARNING message ; data test4; set sashelp.class; newvar = put(age,$3.); run;

Hope this is helpful.

Mark Terjeson Senior Programmer Analyst, IM&R Russell Investment Group

Russell Global Leaders in Multi-Manager Investing

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Yongshan Lin Sent: Friday, September 29, 2006 11:26 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Question about PUT numeric into character in PROC SQL

* Hi all, I got a simple question but don't know the answer.

I have a numeric variable and want to use PROC SQL to change it into character variable, but failed. However when I use data step to do it, it works, as follows.

Any input will be appreciated. Thanks.

*********************************************; data* test; input var; cards; 12 ; proc sql; create table test2 as select put(var,$3.) as newvar from test; *****This one does not work; ** *data* test2; set test; newvar = put(var,$3.); run; **** This one works;

Back to: Top of message | Previous page | Main SAS-L page