DATA Step, Macro, Functions and more

proc sql length

Reply
N/A
Posts: 0

proc sql length

How do I specify the length of v?

proc sql noprint;
select rate
into :v
from test1;
quit;
N/A
Posts: 0

Re: proc sql length

Posted in reply to deleted_user
Super Contributor
Super Contributor
Posts: 3,174

Re: proc sql length

Posted in reply to deleted_user
Most likely you will want to use a FORMAT= on the SELECT clause, specified after the SAS variable name -- this would be if you are attempting to truncate a CHARACTER variable or if you want to "format" the output of a NUMERIC variable.

Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 474

Re: proc sql length

Simply as this:
[pre]
proc sql noprint;
select rate length=8
into :v
from test1;
quit;
[/pre]
But I suspect that's not what you need.
As Scott suggested, I'm guessing you want to format rate in some specific way.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
Valued Guide
Posts: 2,177

Re: proc sql length

Posted in reply to deleted_user
same as normal
format the source, and that is what appears in the destination
proc sql noprint;
select rate format= best20.
into :v
from test1;
quit;

of course, if you want to remove leading/trailing blanks

%let v = &v ; Message was edited by: Peter.C trim lead/trailing blanks
N/A
Posts: 0

Re: proc sql length

This is what I want.
I just used format=5.2 instead of best20.
Thanks.
Ask a Question
Discussion stats
  • 5 replies
  • 208 views
  • 0 likes
  • 4 in conversation