全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2504 7
2008-06-20

There are 10 cases,  each case has 25 variables  from x1 to x25. The purpose is generate a new variable X, and

 X=x1+x2+... +x25 for each case.

Could any expertise of SAS macro language write a SAS code for me or give me a suggestions?

Thank you for your help.

二维码

扫码加我 拉你入群

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

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

全部回复
2008-6-21 02:05:00

What do you mean by 10 cases? you have 10 different tables or you have a variable named 'case'?

if ur table looks as case, x1 -- x25 then all you need to do is in the data step

data new; set data old; x=x1+...+x25;

please tell me hows your data looks like...

best regards,

二维码

扫码加我 拉你入群

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

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

2008-6-23 23:42:00

In my statement, the 10 cases mean the sample size is the 10.

Yes, your right. it can be done in the data step as you said. But I don't think it is smart way.It also can be done using the function of sum.

It is difficult to deal with it as your method. Becasue there are 25 variables. If there are more than 300 variables. It is more difficlut. I want to use a loop  to deal with it based on macro language. 

二维码

扫码加我 拉你入群

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

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

2016-10-31 13:42:27
llulla 发表于 2008-6-23 23:42
In my statement, the 10 cases mean the sample size is the 10. Yes, your right. it can be done in the ...
how did you solve this problem at last?
二维码

扫码加我 拉你入群

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

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

2016-10-31 14:45:38
用个数组不就完事了,非得纠结于宏,嗨。。。。。。。。。。。。
二维码

扫码加我 拉你入群

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

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

2016-11-1 01:02:04
Thanks for your response, although it is a 8 years post. All of us have been changed, including you and me !
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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