A*******s 发帖数: 3942 | 1 besides smileguy's way, i think you can also use tranwrd function to do that.
say,
quoted_line=cats('"', tranwrd(trim(line), ' ', '" "'), '"'); |
|
R*********i 发帖数: 7643 | 2 Still tranwrd. Use ' CO': tranwrd(yourvariable,' CO','');
好。 |
|
d******9 发帖数: 404 | 3 Good job!
y=translate(x, '0', ' ');
使用 tranwrd 似乎也可以吧。
y=tranwrd (X, '', '0 '); |
|
d*******8 发帖数: 321 | 4 先看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.
这个题挺搞,出现多次,只是顺序不同。 |
|
p********a 发帖数: 5352 | 5 %let x=a b c d;
%let y=a b;
%let z=%sysfunc(tranwrd(&x, &y,));
%put &z; |
|
x*******u 发帖数: 500 | 6 这个code不适用于a b c d次序是乱的。如果是下面这种情况,就不行。
%let x=a b c d;
%let y=a c;
%let z=%sysfunc(tranwrd(&x, &y,));
%put &z;
谢谢了 |
|
D******n 发帖数: 2836 | 7 how about this?
%let sites =site1 site3 site6;
data _null_;
siteno = substr(tranwrd("&sites","site",","),2);
call symput("siteno",siteno);run;
and |
|
d*******1 发帖数: 854 | 8 比如你的SAS文件叫test.
data test;
a=1;b=1; output;
a=2;b=2; output;
run;
用下面的code, SAS-> CSV-> SAS-> 加# -〉CSV
proc export data=test
outfile='c:\test.csv' replace;
run;
data testx;
infile 'c:\test.csv' truncover;
input raw $1-100;
run;
data testx;
set testx;
if _n_=1 then raw='#'||trim(left(tranwrd(raw,',',',#')));
run;
data _null_;
set testx;
file 'c:\testx.csv' dlm='09'x;
put raw;
run; |
|
d*******1 发帖数: 854 | 9 先用proc import把csv file 读进去再说。 注意用guessingrows=XXXXXX.
然后再用tranwrd() 和scan() 把相应的record parse出来。
,"/"也被读进去了 (比如说 ‘/// NP_00100’)。 怎末该这个code啊?多谢! |
|
l***a 发帖数: 12410 | 10 you can try sas pearl syntex. or use the combination of some sas functions (
scan, translate, compbl, tranwrd... etc). I used the 2nd method and it works
well |
|
i*********9 发帖数: 44 | 11 我想到一个办法
首先用SCAN找出所有结尾为INC,-CL A的observations
然后用tranwrd来把它们都替换为' '就行了 |
|
|
s******y 发帖数: 352 | 13 Yes, But still have to work little bit harder. not sure if there are other
ways around.
proc format;
value a
0-30000 = 'a*.1'
30000-60000 = '30000*.1 + (a-30000)*.25'
60000-80000 = '30000*.1 + 30000*.25 + (a-60000)*.30'
;
run;
data test;
do a=10 to 80000 by 5000;
b='%sysevalf('||strip(tranwrd(put(a,a.),'a',a))||')';
c=resolve(b);
output;
end;
run; |
|
D******n 发帖数: 2836 | 14 create a .vim directory under you home directory(there is a dot before
vim)
and then create a syntax directory under it
and then create a sas.vim file under the syntax directory
==============sas.vim======================
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case ignore
syn region sasString start=+"+ skip=+\\|\"+ end=+"+
syn region sasString start=+'+ skip=+\\|\"+ end=+'+
" Want region from 'cards;' to ';' to be captured (Bob Heckel)
sy... 阅读全帖 |
|
p********a 发帖数: 5352 | 15 I used the following codes. Could you help me to take a look and see what is
wrong? Thanks
%let datestamp=%sysfunc(today(),yymmddn8.);
%let datestamp1=%sysfunc(datetime(),datetime20.);
%let datestamp2=%substr(%sysfunc(tranwrd(&datestamp1,:,_)),1,15);
%put &datestamp1 &datestamp2;
ODS listing close;
ODS tagsets.ExcelXP path = "/sassvr1/test_report" file="sassrv1_at_%bquote(
&work1pct.)._&datestamp2._CST.xls"
style=EGDefault options( autofilter='all' embedded_titles='yes' autofit
_height= 'y... 阅读全帖 |
|
k*****u 发帖数: 1688 | 16 原作者为 爱萌@人大经济论坛,本文是我转载过来的。
文本挖掘是新时期人们对数据的更加深入的需求的,文本挖掘的原材料是各种文本格式
的文本,文字,图片,通过这些来分析相似,关键性,内部蕴涵的逻辑结构等等.
文本数据多是半结构化的数据,(结构化数据是有一定规律的数据,半结构化,是这些文本
有标题,作者,出版日期,类别等结构的东西,同时也有非结构的成分:内容)
文本挖掘有很多方法,基于关键字的方法,标记方法,信息提取方法.
web挖掘是对网页的挖掘,这是因为随着www的发展,
越来越多的信息在网络中,这些数据不仅对商业,对经济,
而且对政治,文化有很深远的影响. web挖掘可以分为web内容挖掘,web结构挖掘,web使
用挖掘,
可以根据html语言对web进行文本挖掘从而达到web挖掘,
但是很多网页并不遵守W3C html规范.
如何通过SAS进行编程对文本,web进行挖掘
为什么我一直在说SAS的文本挖掘和web挖掘,因为这些程序我还不知道如何编写,
其他程序我都知道了,也编写过了.
这是与算法相关的了!
文本挖掘是数据挖掘的一种,有时也看成是质性研究的一种方法。大致的... 阅读全帖 |
|
d******9 发帖数: 404 | 17 What do you want? To find it or replace it??
data A;
A='ABCDE:FGHIJK';
B=find(A, ':');
C=substr(A,6,1);
D=tranwrd(A,':','---');
run;
proc print;
run;
It works:
Obs A B C D
1 ABCDE:FGHIJK 6 : ABCDE---FGHIJK |
|
l******m 发帖数: 111 | 18 HAHA,
two more lines,
data A;
A='ABCDE:FGHIJK';
B=find(A, ':');
C=substr(A,6,1);
D=tranwrd(A,':','---');
E=SCAN(A,1,':');
F=SCAN(A,-1,':');
run; |
|
d******9 发帖数: 404 | 19 If you do NOT have so many variables, you can rename the variables manually,
the below MACRO will work.
Please send me your BAOZI, thank you.
-------------------------------------------------------------
libname A 'your physical path';
****Use SAS MACRO to read in external CSV files from storage library.****;
filename Raw 'your physical path';
data AAA (drop=RC);
length Memname In_Name Out_Name $30;
Did=dopen("Raw");
if did> 0 then do;
Num=dnum(did);
do J=1 to Num;
Memname=dread(did, J);
In_Na... 阅读全帖 |
|
|