楼主: llulla
2281 7

help for caculate the total value for the variables using macro language [推广有奖]

  • 2关注
  • 7粉丝

VIP

讲师

22%

还不是VIP/贵宾

-

威望
0
论坛币
22712 个
通用积分
12.9349
学术水平
118 点
热心指数
151 点
信用等级
81 点
经验
14275 点
帖子
475
精华
0
在线时间
317 小时
注册时间
2007-5-11
最后登录
2019-7-30

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

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.

二维码

扫码加我 拉你入群

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

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

关键词:Variables Variable Language caculate Using Using value Macro Language caculate

沙发
pywolf 发表于 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,

-=pywolf =- I am a Mathematician & a Statistician; and I have an imagery friend.

使用道具

藤椅
llulla 发表于 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. 

使用道具

板凳
baiyaoqian 发表于 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?

使用道具

报纸
learsaas 发表于 2016-10-31 14:45:38 |只看作者 |坛友微信交流群
用个数组不就完事了,非得纠结于宏,嗨。。。。。。。。。。。。

使用道具

地板
llulla 发表于 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 !

使用道具

7
learsaas 发表于 2016-11-1 09:05:32 |只看作者 |坛友微信交流群
把你的数据集贴部分出来,帮你写成宏

使用道具

8
llulla 发表于 2016-11-3 14:38:41 |只看作者 |坛友微信交流群
谢谢你的热心。8年前的老帖子了,问题已解决了,课题已结束,文章都发表过了。以后有问题再请你帮忙。

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-27 20:14