由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - %do questions
相关主题
sas 代码问题sas题目恳请前辈指点!!
请教一个SAS问题:怎样平均地把obs从小到大分成几个Group?菜鸟请教关于赋给macro variables变量值
SAS Macro Functionhow to use first.var in sas macro?
Please help with a SAS macro[SAS]怎么快捷地删除Macro 里创建的临时dataset和macro variab
问个SAS题目,question about using sas macro variable and do loop
请教这种freq 该用什么code算(sas)?Thanks!one little SAS question
求一段SAS codeSAS ADV passed!!!
【包子】求问个简单sas macro问题请帮忙看3道SAS题。
相关话题的讨论汇总
话题: do话题: sas话题: charstr话题: macro话题: let
进入Statistics版参与讨论
1 (共1页)
s*******d
发帖数: 132
1
How to assign a bunch of numbers in a %do loop in a macro?
%do i=1, 3, 6, 7;
....
%end;
It doesn't work in SAS
Any sugggestion?
A*******s
发帖数: 3942
2
not sure if there is a better way but i do it in such a stupid way:
%let charstr=1 3 6 7;
%let i=1;
%do %while (%scan(&charstr, &i) ne );
%let j=(%scan(&charstr, &i);
%let i=%eval(&i+1);
......
%end;

【在 s*******d 的大作中提到】
: How to assign a bunch of numbers in a %do loop in a macro?
: %do i=1, 3, 6, 7;
: ....
: %end;
: It doesn't work in SAS
: Any sugggestion?

d*******1
发帖数: 854
3
Yes,I cannot understand why sas does not make this simple thing easy. Like what'Re does

【在 A*******s 的大作中提到】
: not sure if there is a better way but i do it in such a stupid way:
: %let charstr=1 3 6 7;
: %let i=1;
: %do %while (%scan(&charstr, &i) ne );
: %let j=(%scan(&charstr, &i);
: %let i=%eval(&i+1);
: ......
: %end;

l*********s
发帖数: 5409
4
this is not easy to implement in text-based macro language

what'Re does

【在 d*******1 的大作中提到】
: Yes,I cannot understand why sas does not make this simple thing easy. Like what'Re does
h**********e
发帖数: 44
5
First create a dataset:
data index;
input i;
datalines;
1
3
6
7
run;
Then
%do j=1 &to 4;
data a;
set index (obs=&j);
call symput('i',i);
run;
/*do whatever you want to do with &i here*/
...
%end;
This is what I usually do this kind of work. Remember macro in SAS is not as
easy as function in C. SAS is dataset oriented in most of the cases.

【在 s*******d 的大作中提到】
: How to assign a bunch of numbers in a %do loop in a macro?
: %do i=1, 3, 6, 7;
: ....
: %end;
: It doesn't work in SAS
: Any sugggestion?

1 (共1页)
进入Statistics版参与讨论
相关主题
请帮忙看3道SAS题。问个SAS题目,
[合集] sas advance question请教这种freq 该用什么code算(sas)?Thanks!
why this error in %if statement求一段SAS code
[合集] 一道SAS Advanced 题目--关于call symput【包子】求问个简单sas macro问题
sas 代码问题sas题目恳请前辈指点!!
请教一个SAS问题:怎样平均地把obs从小到大分成几个Group?菜鸟请教关于赋给macro variables变量值
SAS Macro Functionhow to use first.var in sas macro?
Please help with a SAS macro[SAS]怎么快捷地删除Macro 里创建的临时dataset和macro variab
相关话题的讨论汇总
话题: do话题: sas话题: charstr话题: macro话题: let