s*****9 发帖数: 285 | 1 &convert will resolve to
strip(name1)_n=input(strip(name1),best12.);
strip(name2)_n=input(strip(name2),best12.);
.....
strip(namen)_n=input(strip(namen),best12.);
?
what's in vcolumn?
name1;name2;....namen? |
|
t*****8 发帖数: 157 | 2 i 不需要定义。这是Carpenter__s_Complete_Guide_to_SAS_Macro的一个程序在131页。
**********************;
***6.5.3c
***
**********************;
proc summary data=sasclass.clinics noprint nway;
class clinname;
var dob;
output out=cnt n=count;
run;
data _null_;
set cnt;
i+1;
ii=left(put(i,best12.));
call symput('name'||ii,clinname);
call symput('cnt'||ii,left(put(_freq_,best12.)));
call symput('namecnt',ii);
run; |
|
j******o 发帖数: 127 | 3 Not fancy, but should works.
------------------------------------
data have;
input time $;
datalines;
10175996
10175925
;
run;
data obtain;
set have;
if input(substr(time, 7,2), best12.)<=30 then time1=substr(time, 1, 6);
else do ;
x=input(substr(time, 1,6), best12.)+1;
time1=put(x,z6.);
end;
run;
------------------------------------ |
|
o******6 发帖数: 538 | 4 ☆─────────────────────────────────────☆
lrxlrx (我爱统计) 于 (Mon Feb 18 16:34:49 2008) 提到:
what is BEST12. format in SAS? where can I find the definition? I'm about to
take SAS base.
Please help.
Thanks a lot
☆─────────────────────────────────────☆
lrxlrx (我爱统计) 于 (Mon Feb 18 17:27:06 2008) 提到:
nobody?
ziji ding
☆─────────────────────────────────────☆
shac (本赛季战况,0 : 1) 于 (Mon Feb 18 17:27:53 2008) 提到:
google
to
☆─────────────────────────────────────☆
AdvancedEdu (飞越重洋) 于 (Mon F |
|
k*****u 发帖数: 1688 | 5 data ss;
input a b $;
cards;
123456789012 123456789012
;
proc print data=ss;
run;
不是默认的长度都是8么。为什么num的时候显示12位,char的显示8位?
什么时候num是best12? 多谢回答
谢谢 |
|
c*****t 发帖数: 1712 | 6 When outputing numeric data without a format specification, SAS uses the
default BEST12. format. |
|
p********a 发帖数: 5352 | 7 numerical default informat: best12.
Char default informat: $8. |
|
O*****y 发帖数: 222 | 8 char 是一个 byte (8个bits) 存一个,所以8位就是存8个字符
num 同样也是用8位(8 bytes)存,但是一个byte可以存1--2^8中的
任意一个数,所以用8位最大可以存(2^8)^8 这么大的数(理论上)
在打印一个num variable的时候,如果没有设定打印的format, SAS
默认用best12打印。 |
|
A*******s 发帖数: 3942 | 9 look up table?
use proc format and then r=input(put(t, yourformat.), best12.); |
|
a****l 发帖数: 245 | 10 b has been automatically converted into characters by using the default
format BEST12. during the concatenation step.
So, the length for the new created variable x and y should be 14 (2+12). |
|
d**********o 发帖数: 1321 | 11 %let v_local_time = 01-jan-2011;
proc sql;
create table ni_adjustment_factor1 as
select &v_local_time as local_time, '2_Plus' as demo_value,
SUM (weightp * (hh_size - hh_2_plus)) AS uk_total
FROM gnett.intl_gnett_ue a, gnett.intl_gnett_fieldwork_final b
WHERE a.local_time ='01-jan-2011'd
and a.id=input(b.respondent_id || b.fieldwork_month,best12.)
AND b.fieldwork_year||b.fieldwork_month in ('201004','201007','
201010','201101')
AND ( b.q4 = 1 ... 阅读全帖 |
|
d**********o 发帖数: 1321 | 12 It works!谢谢!
%let v_local_time = 01-jan-2011;
proc sql;
create table ni_adjustment_factor as
select "&v_local_time" as local_time, "&var" as demo_value,
SUM (weightp * (hh_size - &var)) AS uk_total
FROM gnett.intl_gnett_ue a, gnett.intl_gnett_fieldwork_final b
WHERE a.local_time = "&v_local_time"d
and a.id=input(b.respondent_id || b.fieldwork_month,best12.)
AND b.fieldwork_year||b.fieldwork_month in (
select yeamo... 阅读全帖 |
|
h********o 发帖数: 103 | 13 When SAS encounters a number and character string is expected, it will
automatically convert the number to a character string using the BEST12.
format. |
|
d***n 发帖数: 43 | 14 Product_Number has numeric format best12, so there are 8 extra spaces before
5461.
the output data set? |
|
d******9 发帖数: 404 | 15 From SAS Support:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/d
Details
The LENGTHC function returns the number of characters, both blanks and non-
blanks, in string. If string is a numeric constant, variable or expression (
either initialized or uninitialized), SAS automatically converts the numeric
value to a right-justified character string by using the BEST12. format. In
this case, LENGTHC returns a value of 12 and writes a note in the SAS log
stating that the numeric value... 阅读全帖 |
|
d******9 发帖数: 404 | 16 Hehe.......
Because phonenumber is a numeric var, when use Substr function SAS will convert it into character by Best12 format by default: adding 2 blanks in ahead of 3125551212. |
|
o*******w 发帖数: 2310 | 17 I think I know the BEST12, but
substr(phonenumber,1,3)=312xxxxxxx (x is spaces)
then code = (xx312xxxxxxx)
why (X3)? |
|
d******9 发帖数: 404 | 18 I told u SAS add blanks in front of the numeric value when applying Best12
format, not after it:
so,
substr(phonenumber,1,3)= substr(xx3125551212) ='xx3'
code= '('!!substr(phonenumber,1,3)!!')' ='(xx3xxxxxxx...)'
The total length of code is 14, 12+2=14 actually !!! |
|
g******d 发帖数: 231 | 19 我用了下面的code把 .csv 文件import到SAS里。file有很多columns, 而且都带有小数
位。
PROC IMPORT OUT=work.getit
FILE="C:\source.csv"
DBMS=csv REPLACE;
GETNAMES=YES;
DATAROW=2;
RUN;
import之后出现了一个状况:有一个column不能import成功。
在log file中其他的column的import过程显示:informat varname best32. -->
format varname best12. (input varname)。
但是这个column的显示是informat varname $1. --> format varname $1. (input
varname $ ). 但是明明source file中,该column就是numeric的。
请大虾指教。这是怎么回事,有办法修正吗?
十分感谢! |
|
k*******a 发帖数: 772 | 20 可以用 SAS 的dictionary来找出data有什么variable
data test;
input var1 $ var2 $;
datalines;
3.4 5
4.55 5.3
4 3.444
;
run;
proc sql noprint;
select strip(name)||"_n=input("||strip(name)||",best12.)" into :convert
separated by ";"
from sashelp.vcolumn
where libname="WORK" and upcase(memname)="TEST";
quit;
data test1;
set test;
&convert;
run; |
|
h***y 发帖数: 162 | 21 我想这样:
array whatever 200910-201201;
do over;
if date = input(vname(whatever),best12.) then a = ...;
end;
大概是这个思路,语法可能有问题,具体看数据是什么,应该可以的 |
|
l********a 发帖数: 3384 | 22 SAS format: best12.
SQL format: bigint
用Proc SQL插入,没错误信息,但是插入值不是原来的值。 什么原因?怎么解决? 谢
谢! |
|
H*******r 发帖数: 98 | 23 非高手,抛砖引玉
data newset;
set oldset(rename=(var=var1));
var= input(var1, best12.);
drop var1;
run;
位置问题,可以用attrib |
|
P****D 发帖数: 11146 | 24 妾特别讨厌SAS这一点,macro variable都是字符变量。字符变量就有长度和空格的问
题。
你把这个条件改成input(&i, best12.)=0,结果如何? |
|
s******8 发帖数: 102 | 25 SAS把数字自动转换成字符,with format of best12.但数字值是右对齐的,所以左侧
自动填了两个空格使得整个字符串长度达到12. |
|