楼主: je5168
41493 12

[原创博文] [求助] sas 中 input @与@@ 的区别是什么 [推广有奖]

  • 0关注
  • 0粉丝

已卖:69份资源

硕士生

2%

还不是VIP/贵宾

-

威望
0
论坛币
58 个
通用积分
0.1838
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
126 点
帖子
138
精华
0
在线时间
45 小时
注册时间
2008-10-7
最后登录
2014-5-5

楼主
je5168 发表于 2009-4-8 03:55:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
<br/>各位大侠,sas 中 input 变量1   变量2  @ 与 @@ 有什么区别?output时会有什么不同,万分谢谢<br/>
二维码

扫码加我 拉你入群

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

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

关键词:Input put output outpu 各位大侠

回帖推荐

liugxhk 发表于3楼  查看完整内容

One @ sign means conditional input. That is, the data record from the raw data will be saved in the input buffer and will not be saved to the corresponding variable. Only when the second "input" statement is encountered can the raw data be read into the SAS data set. For double @@, sometimes each line of the raw data is longer than the size of SAS input variables, and the input will only stop once ...

本帖被以下文库推荐

沙发
rdzr 发表于 2009-4-8 08:42:00

lz,你将两者在SAS上运行一下,区别不就出来了吗?比如:第一次运行 input x1 x2 @;第二次运行 input x1 x2 @@;这样一比较,二者的不同不就一目了然了吗?

藤椅
liugxhk 发表于 2009-4-12 10:20:00
One @ sign means conditional input. That is, the data record from the raw data will be saved in the input buffer and will not be saved to the corresponding variable. Only when the second "input" statement is encountered can the raw data be read into the SAS data set.

For double @@, sometimes each line of the raw data is longer than the size of SAS input variables, and the input will only stop once the end of line is encountered in the raw data set. For example,

data example
    input group $ score @@;
    datalines;
    1 100 1 200 1 300
    2 120 2 210 2 320
    3 310 3 420 3 540;
run;

proc print;
run;

In the example above you need to use double trailing @@ sign since each row of the embedded data has three observations

The output of the example looks like:

ob     group    score
1         1         100
2         1         200
3         1         300
4         2         120
5         2         210
6         2         320
7         3         310
8         3         420
9         3         540




已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

板凳
je5168 发表于 2009-4-15 04:43:00

谢谢了

报纸
renda_shitou 发表于 2010-2-2 08:51:33
多谢!!!!

地板
frackdeng 发表于 2010-2-2 11:31:26
可以解释下下面的@是什么作用吗?


data NYC;
input city $ 18-32 @;

if city='New York';

input FLNO 1-4 AirLine $6-18 city $ 18-32 Time $34-40;

cards;

9238 American      New York       10:00
4235 United          Philadelphia    5:00pm
798   Delta            New York       8:50
4824 North West   Houston         12:30pm
1639 South West  Chicago          4:15pm
5417 North West   New York       11:25
;
run;
Proc print data=NYC;
title 'Flight to New York City';

run;



3# liugxhk

7
醉_清风 发表于 2010-2-2 12:44:19
是不是换行的意思?
其实实践中很少用到 因为数据已经是有的
从来不需要想起 永远也不会忘记

8
dolphinfish 发表于 2010-2-16 18:05:45
the new data set will only take records which have City = "New York" and discard the rest.  @ means the program will put the input process on hold to make the conditional assessment.

9
lqyrendajinji 发表于 2010-2-17 12:19:08
1 2
3 4

input a@;
input b;

hold current record for input
a=1 b=2

input a
input b
a=1 b=3

10
wxf0701 发表于 2011-1-25 14:13:43
the difference is how long they hold a line of data for input. The trailing @ holds a line of data for subsequent INPUT statements, but releases that line of data when SAS returns to the top of the DATA step to begin building the next observation. The double trailing @ holds a line of data for subsequent INPUT statements even when SAS starts building a new observation. In both cases, the line of data is released if SAS
reaches a subsequent INPUT statement that does not contain a line-hold specifier.

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

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