d*******o 发帖数: 493 | 1 加起来如何?
if (index(lowcase(descriptions),'apple')+index(lowcase(descriptions),'orange
'+index(lowcase(descriptions),'grape'))>0 then fruit_dummy=1;
else fruit_dummy=0; run; |
|
t*********g 发帖数: 71 | 2 How about this?
if (index(lowcase(descriptions),'apple')
or index(lowcase(descriptions),'orange')
or index(lowcase(descriptions),'grape') )
then fruit_dummy=1;
else fruit_dummy=0; run; |
|
D******n 发帖数: 2836 | 3 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... 阅读全帖 |
|
|
c********g 发帖数: 449 | 5 mitbbs does not care capital or lowcase |
|
c*****s 发帖数: 180 | 6 Default Autocall Library
SAS provides several macros in a default autocall library for you. Some of
the macros in the autocall library that SAS provides are listed here.
Macro Syntax Purpose
%LOWCASE(argument) converts letters in its argument from uppercase to
lowercase
%QLOWCASE(argument) converts letters in its argument from uppercase to
lowercase, and returns a result that masks special characters and mnemonic
operators
%LEFT(argument) removes leading blanks from the argument
%TR |
|
c*****s 发帖数: 180 | 7 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
|
c*****s 发帖数: 180 | 8 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
|
c*****s 发帖数: 180 | 9 Solution to guided practice:
1. Submit the program and examine the output. Notice that the title is
all in lowercase.
2. Read through the messages that were written to the SAS log in Step 1.
Look for the line that says MLOGIC(LOWCASE): This macro was compiled from...
The pathname that is listed is an autocall library.
3. Follow the instructions to browse through the autocall macros that
have been provided for you. |
|
c*****s 发帖数: 180 | 10 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
|
c*****s 发帖数: 180 | 11 Execute autocall macros from a SAS catalog.
1. Copy the following program and paste it into the code editing window:
options mautosource mlogic;
proc print data=sasuser.courses;
title "this title is in %lowcase(LOWERCASE)";
run;
Submit the program. Examine the title in the output.
2. Examine the messages that were written to the SAS log when you
submitted the program in Step 1. Find the MLOGIC message that gives the
location where the |
|
t**********r 发帖数: 182 | 12 一段descriptions中,如果有“apple ”, 或 "orange",或 "grape", 就让fruit_
dummy =1; otherwise, fruit_dummy=0。
I tried the following codes; but these codes can only identify ONE word. How
can I identify multiple similar words??? thanks.
if index(lowcase(descriptions),'apple')>0 then fruit_dummy=1;
else fruit_dummy=0; run; |
|
s******r 发帖数: 1524 | 13 俺希望能filter结果based on macro variable.怎么让下面的code work. 我用macro
function 把varl_lss 改成 “month","id". 但是不work. 各位老大帮忙。
data ttt;
input x $10.;
datalines;
month
id
salary
;
run;
%macro Test(var_ls=&Var_lss);
proc sql;create table ttt2 as select * from ttt
where lowcase(x) not in (&Var_lss);quit;run;
%mend;
%Test(var_ls=month id); |
|
s******8 发帖数: 102 | 14 我觉得应Format比较好。先定义一个Format,暂称之为statefmt, 里面每个州对应一个
不同的数字。
proc format;
value statefmt
alabama='1'
alaska='2'
...
vermont='50';
run;
data two;
set yourdata;
new_var=put(lowcase(state),statefmt.);
run;
或者用macro对每个不同的state值定义一个代码:
%macro s;
proc sql;
select distinct strip(upcase(state)) into: allstates separated by '|'
from yourdata;
%let ns=&sqlobs;
quit;
data two;
set yourdata;
select(strip(upcase(state));
%do i=1 %to &ns;
%let s=%scan(&allstates,&i,'|');
when("&s") new_var=&i;
%end;
otherwise;
en... 阅读全帖 |
|