楼主: yayacuiliu
8795 6

SAS中定义数组的问题 [推广有奖]

  • 0关注
  • 0粉丝

硕士生

22%

还不是VIP/贵宾

-

威望
0
论坛币
4 个
通用积分
2.0004
学术水平
1 点
热心指数
1 点
信用等级
1 点
经验
2817 点
帖子
87
精华
0
在线时间
158 小时
注册时间
2008-9-16
最后登录
2024-9-27

楼主
yayacuiliu 发表于 2013-8-22 10:50:10 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
想将一组变量名定义为数组,jan1996 feb1996 mar1996..................................may2012。一共为209个,我用Array(*)定义出现如下提示:列举的数据集(jan1996-may2013)的字母前缀不同,这种情况下应该如何定义?谢谢啦!


二维码

扫码加我 拉你入群

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

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

关键词:array Jan May 数据集 Ray 如何 字母

沙发
Imasasor 发表于 2013-8-22 12:39:08
data b;
set a(obs=1);
keep jan1996--may2013;
run;
然后整个宏变量
proc sql;
select name into: namelist separated by " " from a;
quit;
然后就可以用这个宏变量了
欢迎加入亚太地区第一R&Python数据挖掘群: 251548215;

藤椅
yayacuiliu 发表于 2013-8-22 13:25:23
Imasasor 发表于 2013-8-22 12:39
data b;
set a(obs=1);
keep jan1996--may2013;
我对宏不是很了解。我看了具体的用法,似乎Proc sql那个语句有些问题哈。这个问题如果用Array能不能解决呢?谢谢了。

板凳
boe 发表于 2013-8-22 13:45:56
受版主启发,可以试试
array mon jan1996--may2013;
中间两横杠
Gorgeous girl , I love !

报纸
Imasasor 发表于 2013-8-22 15:24:37
yayacuiliu 发表于 2013-8-22 13:25
我对宏不是很了解。我看了具体的用法,似乎Proc sql那个语句有些问题哈。这个问题如果用Array能不能解决呢 ...
是有问题,写错了
是 from dictionary.columns where libname="WORK" and memname="A";
欢迎加入亚太地区第一R&Python数据挖掘群: 251548215;

地板
jingju11 发表于 2013-8-23 06:52:07
Imasasor 发表于 2013-8-22 15:24
是有问题,写错了
是 from dictionary.columns where libname="WORK" and memname="A";
Using dictionary tables may be a 'universal' way to read the descriptive information about tables,etc. . In fact, in my machine now, the dictionary is not available at all. To my experience, If you want to find the information about a particular table, using contents statement may be more efficient. Jingju

7
gongxun1234 发表于 2013-8-25 00:12:11
data a;                                                                                                                                       
input jan1996 feb1996 mar1996  apr1996 may1996;                                                                                                
cards;                                                                                                                                         
1 2 3 4 5                                                                                                                                      
2 3 4 5 6                                                                                                                                      
;                                                                                                                                             
run;                                                                                                                                          
proc sql;                                                                                                                                      
select name into: namevar separated by " " from  dictionary.columns where libname="WORK" and memname="A";                                      
quit;                                                                                                                                          
                                                                                                                                               
%put &namevar.;                                                                                                                                
data b;                                                                                                                                       
set a;                                                                                                                                         
array month    &namevar. ;                                                                                                                    
run;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
Tigflanker + 1 + 1 + 1 观点有启发

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 08:39