由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - one quick question in SAS, thank you!!
相关主题
SAS Base 123题中47和112题疑问help for sas program
sas question用R,怎么确定ARRAY里面是不是有特定的COLUMN,并且单独取出这个COLUMN?
问一个SAS format的问题,看似简单一个看着很简单sas的问题
Sas问题, 有包子Urgent R Question
问个r问题R function to tabulate a matrix
求助!请教我这个SAS code哪里错了啊?R data.frame
求问 sas _c_ 什么意思请教...
SAS里怎么根据VALUE来选择需要OUTPUT的COLUMNS请教sas code (array 的问题)
相关话题的讨论汇总
话题: sas话题: 5000话题: question话题: 230话题: quick
进入Statistics版参与讨论
1 (共1页)
w********u
发帖数: 328
1
F1 column low high
1 1 1 19
2 1 1 20
3 1 1 21
30 1 12 48
31 1 13 49
32 1 14 50
33 1 15 51
34 1 16 52
272 1 254 290
273 1 255 291
274 1 256 292
279 1 261 297
280 1 262 298
...........................
actually there're 360 rows. Now I have 5000 natural numbers, from 1 to 5000,
if this particular number is between low and high at the same time, i'll
set it to one, otherwise i'll set it to zero. so i'll do loop from i=1 to
5000 step=1. So the output should have one column which includes 5000 rows.
i tried multiple times but there's still bugs.
here's the major part of my code:
...........
array count{5000};
array low1{230};
array high1{230};
do i=1 to 5000;
do j=1 to 230;
if i>=low1(j) and i<=high1(j) then count(i)=1;
else count(i)=0;
i=i+1;
j=j+1;
end;
end;
..........
so basically, i don't know how to compary one particular number, like 45,
with every row of 'low' and 'high'till the end.
I don't know if anyone could give me some corrections and suggestions!
thank you!!
b******e
发帖数: 445
2
where did you get the number '230' in your code? I couldn't understand your
question.
k*******a
发帖数: 772
3
你这个似乎用sql比较容易点

【在 w********u 的大作中提到】
: F1 column low high
: 1 1 1 19
: 2 1 1 20
: 3 1 1 21
: 30 1 12 48
: 31 1 13 49
: 32 1 14 50
: 33 1 15 51
: 34 1 16 52
: 272 1 254 290

w********u
发帖数: 328
4
because there're 230 rows in the following dataset, i didn't copy them all
because there're too many rows.
F1 column low high
1 1 1 19
2 1 1 20
3 1 1 21
30 1 12 48
31 1 13 49
32 1 14 50
33 1 15 51
34 1 16 52
272 1 254 290
273 1 255 291
274 1 256 292
279 1 261 297
280 1 262 298
s******r
发帖数: 1524
5
Still got lost on what you want to do.
maybe
if _n_ >=low and _n_<=high then countt=1;
else countt=0;

【在 w********u 的大作中提到】
: because there're 230 rows in the following dataset, i didn't copy them all
: because there're too many rows.
: F1 column low high
: 1 1 1 19
: 2 1 1 20
: 3 1 1 21
: 30 1 12 48
: 31 1 13 49
: 32 1 14 50
: 33 1 15 51

D******n
发帖数: 2836
6
You said 360 in your OP. Check your question again.

all

【在 w********u 的大作中提到】
: because there're 230 rows in the following dataset, i didn't copy them all
: because there're too many rows.
: F1 column low high
: 1 1 1 19
: 2 1 1 20
: 3 1 1 21
: 30 1 12 48
: 31 1 13 49
: 32 1 14 50
: 33 1 15 51

1 (共1页)
进入Statistics版参与讨论
相关主题
请教sas code (array 的问题)问个r问题
借人气问一个Excel sampling 问题 (转载)求助!请教我这个SAS code哪里错了啊?
[R] a row of a matrix is not a matrix?求问 sas _c_ 什么意思
count unique values in file with 1 million rowsSAS里怎么根据VALUE来选择需要OUTPUT的COLUMNS
SAS Base 123题中47和112题疑问help for sas program
sas question用R,怎么确定ARRAY里面是不是有特定的COLUMN,并且单独取出这个COLUMN?
问一个SAS format的问题,看似简单一个看着很简单sas的问题
Sas问题, 有包子Urgent R Question
相关话题的讨论汇总
话题: sas话题: 5000话题: question话题: 230话题: quick