全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2430 14
2013-05-02
程序如下:data e;       
input p1 p2;
do i=1 to 16;
a=rantbl(100,p1,p2);
end;
cards;
1/2 1/2
;
run;

日志里显示数据行“有对“p1”无效的数据”,不读。
但是直接用 a=rantbl(100,1/2,1/2);就可以。
因为我的概率有40多项,所以想用cards输入,请问高手这个怎么解决呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-5-2 16:21:18
问题不在rantbl,而是datalines/cards不认识这种分数表示。。那该怎么表示啊?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-3 08:11:27
墨岚 发表于 2013-5-2 16:21
问题不在rantbl,而是datalines/cards不认识这种分数表示。。那该怎么表示啊?
One more reason for the problem, is the function won't take characters as its arguments although you can read the fractions from cards. In fact, a more elegant way to do that is to load/write the values to a macro variable. That will give you a lot more flexibility on programing. Jingju
复制代码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-3 10:17:25
jingju11 发表于 2013-5-3 08:11
One more reason for the problem, is the function won't take characters as its arguments although y ...
Thanks! The idea that input fractions as characters solves my problem indeed('_temorary_' is very useful!). But I recognize code like "a =rantbl(123,.1,1/2,1/3,1/15);" can be read as well .
By the way, can rantbl() generate several radom numbers, instead of one number at a time? I need different numbers in one repeat...
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-3 10:31:04
Yeah, it takes fractions (1/2)but not the character ('1/2').
I don't think think so. as you know, sas function returns one value at a time. If you want to have multiple columns, just insert one more loop, like:
复制代码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-3 10:43:52
jingju11 发表于 2013-5-3 10:31
Yeah, it takes fractions (1/2)but not the character ('1/2').
I don't think think so. as you know,  ...
That's what I did.. Unfortunately, these three numbers are in fact three samples but not three numbers in one sample which is preferred. Still thank u for the confirmation!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群