由买买提看人间百态

topics

全部话题 - 话题: catx
1 (共1页)
A*******r
发帖数: 194
1
来自主题: Statistics版 - 求助 FIND(), cat(), catx() 的用法
I've never taken SAS exams but I think catx() is available since SAS9.1 or
so.
The LITTLE SAS BOOK is not a comprehensive manual anyway. Just check out the
SAS website for those functions.
f******u
发帖数: 250
2
来自主题: Statistics版 - 诚心求教一个macro问题 很费解
you do not need a macro.
data data1(keep=x);
input variableName $14. variableLength : $12. price;
x=catx(' ', variableName,variableLength,price);
datalines;
FundingAmount 0-15000 0.217
ObjectAmount 15000-30000 0.318
FundingAmount 30000-60000 0.519
;
run;
data data2(keep=x);
input firstname : $7.lastname : $7. age;
x=catx(' ',firstname,lastname,age);
datalines;
Ashley Liu 17
brandon green 30
susan Chen 28
run;
data data3;
set data1 data2;
run;
data _null_;
fil... 阅读全帖
A*****a
发帖数: 1091
3
来自主题: Statistics版 - 怎么把带小数的值ROUND 到整数?
不能新建一个变量来做么?
newv=oldv/100应该就可以了。
必须保留字符型么?
那大概得你问的那个substr+catx吧
newv=catx(".",substr(oldv,?,?),substr(oldv,?,?));
?你自己填。。。
这样能行不?
e******o
发帖数: 53
4
在孕妇装店里拿到的coupon, cord blood $400 off for CA and TX residents.
Coupon code: HE1-CATX
Viacord sales 说可以用,截止日期不详(估计argue argue一直都能用)
有需要的童鞋们可以用。
m******8
发帖数: 122
5
来自主题: Statistics版 - 终于考完了,贡献一下
非常感谢版友提供的资料和信息。
觉得看那个online-tutor和50题很有帮助,有很多题都是一摸一样的。
有一些是online-tutor上没有的。我看了版里的帖子,所以有些准备。可惜我记忆力太
差,有些东西还是没有记住。
有考到find(),cat(),catx(),left(),like '_i%'
先format后set
先set后length
下面是一些散的题目,希望对各位有帮助
m******g
发帖数: 108
6
来自主题: Statistics版 - base 和advance 考试的体会
我也考完了, 跟大家分享一下吧。
我是文科里比较多量化知识的专业,以前用Stata, 学过R。准备考SAS的证书是因为未
来工作主要用SAS, 想借考证学习一下,有了证书说不定以后跳槽也容易点,呵呵。
我6月12号考的base, 7月7号考的advance. 用的材料主要是:
base: little sas book+online tutorial+50题。
advance: online tutorial+50题。
感觉这些材料足够了,哪怕对一个新手来说。 base考试好像不考base tutorial里
graphics的章节, 也不考SQL. 考试的时候碰上了一些很偏的function, 例如cat,
catx,什么的(不好意思实在记不起来其它的了), 好像是tutorial里面没有的。
advance考试主要是考理解,我sql部分掌握得很好,macro就彻底菜鸟了,确实没搞清
楚global,local`间变量的传递。一般就是
%let a=b;
%let b=c;
%let c=d;
%let d=e;
下面是nested macro programs,
最后问你用%put
s*********t
发帖数: 173
7
来自主题: Statistics版 - 今天通过sas base
今天通过sas base.想得起来的题目有:
1)do year=1 to 5;
do month=1 to 12;
x+month;
output;
end;
end;
问最后有多少observation?
1? 5? 0? 60?
2)do year=1 to 5;
do month=1 to 12;
x+month;
end;
end;
问最后有多少observation?
1? 5? 0? 60?
3)考到where 中like的用法(以前只见过lt, gt等)
4)考到catx function
祝其他的战友考试顺利!
A*********u
发帖数: 8976
8
来自主题: Statistics版 - SAS 问题
cat
cats
catx

有谁知道怎么用字符运算“!!”?
b********g
发帖数: 1
9
来自主题: Statistics版 - SAS base 87% pass today
At least 50% in base 50 and 123. Many thanks to this board.
Something new or unsure:
1
x='372';
y='234 ';
z='657';
how to get 372-234-657
a. cat('-',x,y,z)
b. catx('-',x,y,z)
c. x!!'-'!!y!!'-'!!z
d.x!!'-'!!left(y)!!'-'!!z
2 _'char'% function
data test;
input name $;
datalines;
Liu
Ellisa
Risa
Loui
;
run;
data test2;
set test;
name2=(_'i'%);
run;
what is the value(s) of name2?
3 where is format saved if not saved permanently?
4. FOUND function;
5 function (trch? not remembered) to cha
s*******2
发帖数: 791
10
来自主题: Statistics版 - SAS base 87% pass today
1. b. catx('-',x,y,z)
7. Obs x y z
1 1 a 2
2 1 b 4
3 2 a 3
4 2 b 5
5 3 a 4
6 4 a 6
7 4 b 7
g*******t
发帖数: 124
11
来自主题: Statistics版 - 今天考了sas base
里面有一道题考了find,一道题考了like,还有个cat/catx
没考的人可以看看这三个命令,因为online tutorial里面没有。。我是瞎蒙的。事后证
明都蒙错了:(
很多题都是50、123题上的。
G**S
发帖数: 1108
12
来自主题: Statistics版 - 如何在sas里读入849.342的日期?
for values smaller than 1582,you can try this:
x=849.32;
y=int(x);
m=int((x-y)*12);
d=int((x-y)*365.25-(((365 * 4) + 1)/48 )*m);
date=catx('-',put(y,z4.),put(m,z2.),put(d,z2.));
l**g
发帖数: 69
13
来自主题: Statistics版 - SAS Base Pass
93% pass. 基本上是Base 123 和 50 里的题,不是相似,是一摸一样。online tutor
里面没有讲但是有考的是 like operator,还有cat, cats,catt,catx函数
r******h
发帖数: 46
14
来自主题: Statistics版 - 刚过sas base,考完的几点建议
Nested do loop,一定要弄懂output出现在哪里会有多少个obs,比如出现在第一个end
前有几个,第二个前,或者不出现,最好自己试一下
还有123里,如果答案是有错没执行,一定要知道是哪里错,因为考试可能问是哪里错
catx要看,我就是看到有人说考了,但没看,果然,我也考到了,猜了一个
有几个点是试题上没有的,但不太记得了,好像有一个是find( )
暂时就这样了。
d*******8
发帖数: 321
15
先看online tutor,一定要知道各个Function的结果。然后做50和123,肯定能通过。
考题先
1, '_i&', 蒙了个答案。
2, catx, left?
3, weekdate, 要知道结果。
4, tranwrd, length?
5, format saved at where? sas catalog? work ligbrary?
6, data test1;
set test2;
vab1='ABC';
length vab1 $7.
the length of vab1 at test2 is $5.
asking the length of vab1.
这个题挺搞,出现多次,只是顺序不同。
d*******t
发帖数: 75
16
不是 “_ i&" ,是"_i%" ,叫做like operator.
可以查一下这方面的资料。
还有 记得看find function 和catx, 肯定会考的。其他的只要把50 和123搞清
楚了,就没问题了。碰到的都是原题,很多连答案都一样。
j******n
发帖数: 2206
17
a=-0.1
b=-0.2
想用/把a和b连在一起,创造一个新的c=a/b=-0.1/-0.2
用什么function?
我试了用c=catx('/',put(a,4.2),put(b,4.2));
但是得到一个很奇怪的数字。
m*********n
发帖数: 413
18
我试了用c=catx('/',put(a,4.2),put(b,4.2));
但是得到一个很奇怪的数字。
change 4.2 to something like 6.2 or 8.2
y****n
发帖数: 46
19
c=catx('/',put(a,4.1),put(b,4.1));
c*****s
发帖数: 180
20
我也考了,但都忘了。楼主说的很全,我补充几点:
4.text="句子";
Find(text',US'i, 5 )问i=?;
5.是给出几个单词,然后问用什么命令能成一个他要求的例子:貌似catx的对。
6.debug还是debuger加在data语句后,好像选项有data sasuser.xxx debug; data....
/debug; data...debuger; data.../debuger;
13 没有PROC REPORT考试内容,大纲不考了。
14.题目特别长,然后问题大体是dlm=还是dsd 和dlm一起用。
16.考点在rename用法还有set a b,set a set b 和merge的区别。还有一题问set a b
的第一行输出是什么。
17.ods csvall "file"...
ods close;
问输出结果的文件是用什么格式读的。选项貌似有excel only.excel, txt and csv
;csv only.

20.如何输出这个lib里的文件名。貌似proc data=something _all_.
其他:
1.
y***t
发帖数: 644
21
来自主题: Statistics版 - 过了Base
84%
受本版帮助挺大的,比如原来不知道去看catx, find, like等,版上有人提到过。 这
些都考到了。
大部分考题记不清了。感觉考试时不确定答案的还是很多的, 我主要看了little sas
book, 50, 123。 online tutor 以前看过一部分。
下面这个网站很好,也是版上一位考友提到的, 有所有123的讨论。
http://sascert.blogspot.com/2006_12_17_archive.html
又报了12月底的advance考试。在看online tutor adv, 发现前几个sql里有关于like,
_ % 这些东西。
h*******d
发帖数: 272
22
来自主题: Statistics版 - 求助 FIND(), cat(), catx() 的用法
第二次准备BASE了 这3个 第一次考的时候碰见过 不会 但现在翻遍了LITTLE SAS
BOOK 也没找到用法啊
请高人指点
急求
谢谢大家
P****D
发帖数: 11146
23
来自主题: Statistics版 - 求助 FIND(), cat(), catx() 的用法
SAS自带的SAS Help and Documentation,有语法说明,有例子。
y****n
发帖数: 46
24
来自主题: Statistics版 - ASK FOR ONE SAS QUESTION
%macro tt;
data old;
length name $20;
do j=1 to 1000;
name=catx('_','xx',j);
%do i=1 %to 100;
test&i=mod(floor(ranuni(2)*1000),3)+1;
%end;
output;
end;
drop j;
run;
%mend;
%tt;
data new;
array tt(100) test1-test100;
array ct1(100);
array ct2(100);
array ct3(100);
set old end=eof;
do i=1 to 100;
if tt(i)=1 then ct1(i)+1;
if tt(i)=2 then ct2(i)+1;
if tt(i)=3 then ct3(i)+1;
end;
d********h
发帖数: 2048
25
来自主题: Statistics版 - 一个sas问题
proc transpose data=test out=test1;
var feature;
by id;
data test2;
length c $ 1000;
set test1 ;
array tmp col1-col3;
do over tmp;
c=catx("_",of c tmp);
end;
proc print;
s******r
发帖数: 1524
26
来自主题: Statistics版 - 一个sas问题
还有包子吗?
sorry. A typo. Just fixed.
proc sort data=aa;by id;run;
data bb;
length check $5500.;
set aa;
by id;
retain check;
check=catx('-',check,feature);
if last.id then do;output;check='';end;
run;
p*******r
发帖数: 1951
27
来自主题: Statistics版 - SAS question
table1是原始数据,table2是变量说明。
data _null_;
set table2 end=eof;
length temp $200.;
if type = 1 then temp=catx(" ",temp,var);
retain temp;
if eof then call symput('vars', temp);
run;
data pick(keep=id &vars);
set table1;
run;
c******n
发帖数: 380
28
if indexc(catx('',of var1-var4),'xyz')>0 then target=1;else target=0
m*****a
发帖数: 658
29
I think this is interesting one. Could you tell me why catx function have to
be used here?
Thanks,
s******y
发帖数: 352
30
来自主题: Statistics版 - SAS MACRO question (包子求教重金酬谢)
%let dirpath=d:;
filename csvfile pipe "dir /b &dirpath.\*.csv";
data allcsv;
infile csvfile lrecl=1000;
input;
fname=catx('',"&dirpath.",_infile_);
infile dummy filevar=fname filename=myfile end=done firstobs=4
dsd truncover;
do while(not done);

input date :date9. Tier :$50. Ccy :$50.
Doc :$50. Sd1y :percent. Sd2y :percent.;

output;
end;
put 'Done with ' myfile=;
run;

external
z***9
发帖数: 1052
31
来自主题: Statistics版 - a little but maybe interesting SAS question
I have a character string say "1, 3, 2"
the order is not desired as "1, 2, 3". of course, we can split it into 3
different variables, and then catx them together with right order we want.
But do we have a function do the trick directly. I remember there's some
function reads the string from memory and may do the trick like this.
10 baozi for the one with easiest solution.
j*****g
发帖数: 36
32
来自主题: Statistics版 - 重新安排变量的问题
proc transpose data = dataset0 out=dataset1 name=variable;
by farm year land;
var var1-var3;
drop _label_;
run;
proc sort data = dataset1;
by farm land variable year;
run;
data dataset2(drop = variable year); set dataset1;
newId = catx("_", variable, year);
run;
proc transpose data = dataset1 out =dataset2;
by farm land;
id = newId;
var = col1;
drop _name_ _label_;
run;
d******9
发帖数: 404
33
来自主题: Statistics版 - 如何把取值为1的column列出来?
Use only 6 variable as an example, you can extend it to 100 variables.
data A;
input Patient $ D1 D2 D3 D4 D5 D6;
cards;
A 1 1 0 0 0 0
B 1 0 0 0 0 0
C 0 1 0 1 0 1
D 1 1 1 1 1 1
;
run;
data C;
length disease $100;
set A;
array D(6) D1-D6;
do I=1 to 6;
if D(I)=1 then do;
Disease=CatX(', ', strip(disease), Vname(D(I)));
end;
end;
drop I;
run;
proc print;
var Patient D1-D6 Disease;
run;
SAS Output:
Patient D1 D2 D3 D4 D5 D6 ... 阅读全帖
d******9
发帖数: 404
34
来自主题: Statistics版 - 如何把取值为1的column列出来?
Another method:
data D;
set A;
array D(6) D1-D6;
do I=1 to 6;
DS=Vname(D(I));
if D(I) =1 then output;
end;
drop I;
run;
proc sort data=D ;
by Patient;
run;
data E;
length Disease $100;
set D;
by Patient;
retain Disease;
if first.Patient then Disease=' ';
Disease=CatX(', ', strip(disease), strip(DS));
if last.Patient then output;
run;
d******9
发帖数: 404
35
Below code may be not a perfect method, but it works.
Use the SASHELP Class data set to create a sample data set.
data A;
retain X Name Y Sex Z Age Height Weight;
set sashelp.class;
if ranuni(7546)<0.3 then X='Yes';
else if ranuni(7546)<0.5 then X='No';
else X=' ';
if ranuni(32681)<0.4 then Y='Yes';
else if ranuni(32681)<0.8 then Y='No';
else Y='***';
if ranuni(510)<0.6 then Z='Yes';
else if ranuni(33201)<0.8 then Z='No';
else Z='N/A';
run;
*******************************
Use array, find all the... 阅读全帖
m***c
发帖数: 118
36
来自主题: Statistics版 - 急请教一个sas 问题
data a;
input ID $ jan feb mar apr may jun jul aug sep oct;
cards;
1 20 30 50 0 50 40 20 70 55 25
2 . . 30 50 0 90 40 0 40 20
3 . . . 60 20 0 50 10 0 40
;
data b(keep=ID time1-time10); set a;
length tot $ 100;
array am(10) jan--oct;
do i=1 to dim(am);
if am(i)<=0 then am(i)=.;
tot=compress(catx('',tot,am(i)),,'p');
end;
array at(10) time1-time10;
do j=1 to 10;
at(j)=scan(tot,j);
end;
run;
M********8
发帖数: 3837
37
一劳永逸,找人来拉cat6(or catX the latest)。HD卖的最高级别的应该是cat6,其他
的接头盒子都能在Fry's找到。对于弯曲的nerd来说,每个房间有宽频接头,还是很爽
的。我们用Uverse, 看电视直接接宽频。
很多电工都接这个活,要是handy也能自己干,最主要有那个HD卖的tool, 一个flexi管
子上的摄像头,$150左右,对于钻墙爬墙的内部非常有用。
如果你反正都要爬一次crawl space, attic,不如把其他的房间都一古脑儿给装了。
1 (共1页)