由买买提看人间百态

topics

全部话题 - 话题: infile
首页 上页 1 2 3 4 5 6 7 (共7页)
s******o
发帖数: 283
1
来自主题: Statistics版 - 请帮忙解答两个SAS base考题
Q1, For this question, why the answer is C not A, the month is descending order
is not July,June and May, Why? Thanks very much for your kind help!
Given the SAS data set WORK.TEMPS:
Day Month Temp
--- ----- ----
1 May 75
15 May 70
15 June 80
3 June 76
2 July 85
14 July 89
The following program is submitted:
proc sort data=WORK.TEMPS;
by descending Month Day;
run;
proc print data=WORK.TEMPS;
run;
Which output is correct?
... 阅读全帖
a*****3
发帖数: 601
2
来自主题: Statistics版 - help! 读CSV文件读得要崩溃了
一步步来,挣个包子真不容易呀
filename read "你的文件名"
data target ;
infile read firstobs=6;
input char1 $ 1-10
char2 $ 15-25
char3 $ 30 -33
; run;
x*******u
发帖数: 500
3
来自主题: Statistics版 - help! 读CSV文件读得要崩溃了
从数据上看第一个变量的长度是10, 但是用你的code读出来结果是这样的:
char1 char2 char3
1 0 / 3 0 0 0 9 .1 4 1
中间还是有空格。
我用proc import读入数据后, log里面是这样的:
data WORK.READASC ;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile 'myfile.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=7 ;
informat VAR1 $21. ;
informat VAR2 $23. ;
informat VAR3 $9. ;

format VAR1 $21. ;
format VAR2 $23. ;
format VAR3 $9. ... 阅读全帖
t****y
发帖数: 576
4
来自主题: Statistics版 - base 70 Q48 no valid answer
看到的答案是A,但实际运行结果state一栏全是empty value,想是因为city被drop,影响
了if statement. 这样一来根本就没有正确答案。
48.The following SAS program is submitted:
data WORK.TEST;
drop City;
infile datalines;
input
Name $ 1-14 /
Address $ 1-14 /
City $ 1-12 ;
if City='New York ' then input @1 State $2.;
else input;
datalines;
Joe Conley
123 Main St.
Janesville
WI
Jane Ngyuen
555 Alpha Ave.
New York
NY
Jennifer Jason
666 Mt. Diablo
Eureka
CA
;
What will t... 阅读全帖
s*********y
发帖数: 34
5
来自主题: Statistics版 - Read informatted Txt Files into SAS
Raw Data:
"MARKETING_ID","CUSTOMER_NAME","Mail_ADDRESS","Mail_CITY","Mail_STATE","Mail
_POSTAL_CODE"
"EA00000","JAMES J IANAZONE","1238 LAKE FRONT BLVD","NORTH LIMA","OH","44452"
"EA00001","MARK A PETERSEN","6715 ERIE AV NW","CANAL FULTON","OH","44614"
"EA00002","BRANDON S BURGER","1694 TANGLEWOOD DR","AKRON","OH","44313"
data edsion;
infile " C:\Documents and Settings\Toledo_Edison_MailingList_03_09_2012 7MWH
.txt" delimiter=",";
input MARKETING_ID $ 2-8 +3 CUSTOMER_NAME $ 11. Mail_ADDRESS $ ... 阅读全帖
c****y
发帖数: 94
6
来自主题: Statistics版 - Read informatted Txt Files into SAS
Try this:
data fun;
infile "C:\Documents and Settings\Toledo_Edison_MailingList_03_09_2012 7MWH
.txt" dsd firstobs=3 dlm=",";
length Marketing_ID $7 customer_Name $20 Mail_address $30 Mail_City $10
Mail_state $2 post_code $5;
input Marketing_ID $ Customer_Name $ Mail_Address $ Mail_City $ Mail_State
$ post_code $;
run;
e******e
发帖数: 410
7
来自主题: Statistics版 - 请教一个SAS 数据读入的问题
两个问题
第一就是前面的sign有可能为负,所以不能直接跳过。‘
第二就是这个数值包括了小数点后的信息。比如说“+00000271750”实际上是2717.50

我现在是这样读:
data xxx;
infile xxx;
input
@1044 variable_name 12.2;
run;
就是不是很肯定这个code 100% correct
e******e
发帖数: 410
8
来自主题: Statistics版 - 请教一个SAS 数据读入的问题
两个问题
第一就是前面的sign有可能为负,所以不能直接跳过。‘
第二就是这个数值包括了小数点后的信息。比如说“+00000271750”实际上是2717.50

我现在是这样读:
data xxx;
infile xxx;
input
@1044 variable_name 12.2;
run;
就是不是很肯定这个code 100% correct
e******e
发帖数: 410
9
来自主题: Statistics版 - 请教一个SAS 数据读入的问题
两个问题
第一就是前面的sign有可能为负,所以不能直接跳过。‘
第二就是这个数值包括了小数点后的信息。比如说“+00000271750”实际上是2717.50

我现在是这样读:
data xxx;
infile xxx;
input
@1044 variable_name 12.2;
run;
就是不是很肯定这个code 100% correct
p********a
发帖数: 5352
10
来自主题: Statistics版 - excel一问
用这个CODE把文件名放MACRO,然后用SAS EXCEL ENGINE去提取
%sysexec cd &dir; %sysexec dir *.txt /b/o:n >flist;
data indexfile;
length filen $200 ;
infile "&dir./flist" length=reclen;
input filen $varying256. reclen;
run;
w********y
发帖数: 371
11
来自主题: Statistics版 - question about SAS BASE 123 NO.110
Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44
The following SAS program is submitted:
data test;
infile 'employee';
input employee_name $1-4;
if employee_name='Ruth' then input idnum 10-11;
else input age 7-8;
run;
Which one of the following values does the variable IDNUM contain when the
name of the employee is "Ruth"?
A.11
B.22
C.32
D. .(missing numeric value)
The answer is B.
I run this code:
data test;
input employee_name $ 1-4;
if employee_name = 'Ruth' then input idnum 10-11;
else input ... 阅读全帖
d******9
发帖数: 404
12
来自主题: Statistics版 - HELP~~About reading sas data set
Hehe..... you need use Missover.
Try below codes:
data students;
infile cards missover;
input gender score;
cards;
1
1 45
2 50
2 42
1 41
2 51
1 52
1 43
2 52
. 12
. 13
;
run;
d******9
发帖数: 404
13
来自主题: Statistics版 - HELP~~About reading sas data set
By default, if SAS can not find values for all the variables defined in
INPUT statement, it will automatically go to NEXT record to read the values
until it get all the values for all the vars.
This is called FLOWOVER, which is the default mode in SAS data step.But, as
you have seen, it may make trouble and destroy the data totally. So,
sometimes we have to disable it.
In this case, we may use Missover/TruncOver/StopOver options in INFILE
statement depending on situations.
For details, view ... 阅读全帖
a**********9
发帖数: 491
14
29.The following SAS program is sumbitted:
data WORK.INF0;
infile 'DATAFILE,TXT';
input @ I Company $20. @25 State $2. @;
if State=' ' then input @30 Year;
else input 4330 City Year;
input NumErnpIoyees;
run ;
How many raw data records are read during each iteration of the DATA step?
A 1
B 2
C 3
D 4
Answer: A
我怎么觉得应该是2呢,因为year 后面没有 @ 啊。
p***7
发帖数: 535
15
来自主题: Statistics版 - help! SAS base 70 problem 17/35
data work.geo;
infile datalines;
input city $20.;
in city='Tulsa' then state='OK';
Region='Central';
if City='LA'then state='CA';
Region='western';
datalines;
Tulsa
LA
BANGOR;
RUN;
After data step execution, what will data set WORK.GEO contain?
The answer is blow
A
CITY STATE REGION
TULAS OK WESTERN
LA CA WESTERN
Bangor WESTERN
I could not understand it. I know there should be @ in the input statement.
but why all the... 阅读全帖
p***7
发帖数: 535
16
来自主题: Statistics版 - sas base (70) problem 59 help
----5----10---
daisyyellow
data flowers;
infile 'typecolor.dat' truncover;
length type $ 5 color $ 11;
input type $ color$;
run;
what are the value of variable type and color?
answer type=daisy color=
what I don't understand is the value of color. How does truncover work?
I look up some definition in sas documentation as followed.
Missover can replace truncover here? which will has the same result?
MISSOVER
causes the DATA step to assign missing values to any variables that do not
have values wh... 阅读全帖
p***7
发帖数: 535
17
来自主题: Statistics版 - sas base 70 key -errors
they are several errors in the key to the problem set.
29
data WORK.INFO;
infile ‘DATAFILE.TXT’;
input @1 Company $20. @25 State $2. @;
if State=’ ‘ then input @30 Year;
else input @30 City Year;
input NumEmployees;
run;
How many raw data records are read during each iteration of the DATA step?
A. 1
B. 2
the answer is A. Is it correct?
I think it should be B
s********1
发帖数: 54
18
来自主题: Statistics版 - One question about data step in sas
Question(1)The following is my sas code: Who can tell me why it is wrong?
###############################
data temm;
length A B 3 X;
input A B X;
cards;
10 20 3
23 34 56
run;
#################################3
Error message:
##########################
78 data temm;
79 length A B 3 X;
-
22
1 1
-
352
ERROR 22-322: Expecting a numeric constant.
ERROR 352-185: The length of numeric variables is 3-8.
80 input A B X;
81 cards;
NOTE: The SAS Sy... 阅读全帖
l*******0
发帖数: 12
19
Can easily be done with any programming.
Here are SAS Codes.
DATA ad (DROP = StartDate EndDate i TotalAmt);
INFILE DATALINES DLM = ",";
INPUT WEB : $20. StartDate : mmddyy10. EndDate : mmddyy10. TotalAmt
DailyAmt;
DO i = 0 TO (EndDate - StartDate);
DATE = StartDate + i;
OUTPUT;
END;
DATALINES;
abc.com, 4/1/2012, 4/30/2012, 30000, 1000
esbn.com, 3/1/2012, 3/15/2012, 10000, 666.67
answer.com, 7/1/2012, 8/1/2012, 50000, 1612.9
;
RUN;
PROC SORT DATA =ad OUT = ad_sorted;
BY DATE;
RUN;
PROC PRI... 阅读全帖
b******s
发帖数: 345
20
来自主题: Statistics版 - 请问base(123题)的第114题
The contents of CALENDAR are listed below:
----|----10---|----20---|----30
01012000
The following SAS program is submitted:
data test;
infile 'calendar';
input @1 date mmddyy10.;
if date='01012000'd then event='january 1st';
run;
Which one of the following is the value of the EVENT variable?
A. 01012000
B. January 1st
C. .(missing numeric value)
D. The value can not be determined as the program fails to execute due to
errors.
Answer: D
程序运行后与D所说一致。不过我不知道这道题的考点是什么? 如果改动 date值,才
能使程序运行呢? 请指教,谢谢!
x*c
发帖数: 156
21
来自主题: Statistics版 - 请问sas base 123 no. 33
QUESTION 33
The contents of the raw data file TEAM are listed below:
----|----10---|----20---|----30
Janice 10
Henri 11
Michael 11
Susan 12
The following SAS program is submitted:
data group;
infile 'team';
input name $15. age 2.;
file 'file-specification';
put name $15. =5 age 2.;
run;
Which one of the following describes the output created?
A. a raw data file only
B. a SAS data set named GROUP only
C. a SAS data set named GROUP and a raw data file
D. No output is generated as the program fails... 阅读全帖
j******o
发帖数: 127
22
来自主题: Statistics版 - How to import several excel files together?
昨天刚写了几段code,不过是对csv的,请你改一下用在Excel文件上吧。中间有些地方
可能不太完善(比如文件名不能有空格等),欢迎改进及简化。
----------------------------------------------------------------
libname backup "C:\Documents and Settings\Ying\Desktop\Test";
filename blah pipe 'dir "C:\Documents and Settings\Ying\Desktop\Test\*.csv"
';
data dirlist;
infile blah truncover lrecl=200;
input line $200. ;
if upcase(substr(line, 1, 9))='DIRECTORY' then call symput('direc', trim
(substr(line, 14, length(line))));
if input(substr(line,1,10), ??... 阅读全帖
k**********a
发帖数: 255
23
来自主题: Statistics版 - 求助 SAS 一个error 老改不对
3222 libname sw 'C:\Users\given\Desktop\sw';
NOTE: Libref SW was successfully assigned as follows:
Engine: V9
Physical Name: C:\Users\given\Desktop\sw
3223 proc format lib=sw;
3224 value $itemfmt
3225 'C'='Cassette'
3226 'R'='Radio'
3227 'T'='Television';
NOTE: Format $ITEMFMT is already on the library.
NOTE: Format $ITEMFMT has been written to SW.FORMATS.
3228 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time ... 阅读全帖
y********0
发帖数: 638
24
来自主题: Statistics版 - 问SAS code怎么写
是用sql,转置一下,取个最小值就成。
data one;
infile datalines;
input id date mmddyy10.;
datalines;
1 08/12/2005
1 09/13/2005
2 01/09/2005
3 01/08/2005
3 01/08/2005
3 02/09/2005
;
proc transpose data=one out=two;
by id;
run;
proc sql;
select id,min(col1,col2,col3) as mdate format=mmddyy10.
from two;
quit;
i*t
发帖数: 835
25
来自主题: Statistics版 - sas base 70的两道题
以前看人讨论过,今天考到了,发现和大家手上的70题有点不一样。大家考试准备的时
候可以注意。一个是45.The following SAS program is submitted:
ods csvall file='c:\test.cvs';
proc print data=WORK.ONE;
var Name Score Grade;
by IdNumber;
run;
ods csvall close;
What is produced as output?
我见到的是ods csvall file='c:\test.csv';
29.The following SAS program is sumbitted:
data WORK.INFO;
infile 'DATAFILE.TXT';
input @1 Company $20. @25 State $2. @;
if State=' ' then input @30 Year;
else input @30 City Year;
inp... 阅读全帖
j******k
发帖数: 91
26
来自主题: Statistics版 - 2013 January 刚考过SAS Adv
基本上还是63题 只有4-5题不太一样
新题基本上还是比较简单的 如果你63题都融会贯通的话
我是把SAS Adv Prepare Guide整本都读过一遍
考题不太懂得自己试过一遍 或者看别人怎么解
原本不怎么用SQL 现在开始在工作上也用看看 感觉SQL很powerful阿!
抱著还是想学一点新的东西去考的 挺有收获的!
置顶上有63题 可以下载 有两个我自己在书上或者网路上找到答案的:
* 答案A:
Item 7 of 63 Mark item for review
A quick rule of thumb for the space
required to run PROC SORT is:
A.
two times the size of the SAS data set being sorted.
* 答案A:
Item 20 of 63 Mark item for review
The following SAS program is submitted:
data WORK.TEMP;
length A B... 阅读全帖
h**e
发帖数: 33
27
有一段很长SAS的code存在txt file里.
我不想copy&paste....
在data step中我想引用这段code,
在找的资料中用infile,但试了总是不work...
请问有什么办法?
t*****i
发帖数: 426
28
which command are you using? If you are using infile, you can define your
own dictionary
S***a
发帖数: 8
29
来自主题: Statistics版 - MySQL求助
真心崩溃了。。。 请问有人知道怎么往SQL里面导入text文件么。 我这个数据特别简
单,只有一列。数据之间都是很整齐的隔开。。。
1.0000000e+000 2.0000000e+000 3.0000000e+000 4.0000000e+000
我不知道怎么改参数项控制 LOAD DATA local INFILE INTO TABLE,现在最多只能读
前面两个数,或者读进来几个0. 请问有人知道我到底做错了什么吗?
w**********i
发帖数: 4
30
来自主题: Statistics版 - 请教下SAS Base 70题的第59题
请大牛指点下第59题。
59.Given the contents of the raw data file TYPECOLOR.DAT:
----+----10---+----20---+----30
daisyyellow
The following SAS program is submitted:
data FLOWERS;
infile 'TYPECOLOR.DAT' truncover;
length
Type $ 5
Color $ 11;
input
Type $
Color $;
run;
What are the values of the variables Type and Color?
A. Type=daisy, Color=yellow
B. Type=daisy, Color=w
C. Type=daisy, Color=daisyyellow
D. Type=daisy, Color=
Answer: D... 阅读全帖
t*********e
发帖数: 313
31
来自主题: Statistics版 - 请教下SAS Base 70题的第59题
data test;
infile datalines truncover;
length
Type $ 5
Color $ 11;
input
Type $
Color $;
datalines;
daisyyellow
;
run;
l******5
发帖数: 176
32
来自主题: Statistics版 - 请教SAS Base50中的41题
data work.family;
infile 'file-specification';
input @1 date_of_birth mmddyy10.
@15 first_name $5.
@25 age 3;
run;
我知道答案,但是不明白真正的原因,那位大牛给解惑一下,谢谢。我试着把age 3.改
为age 2, age 1, age 12, 最后得到的age值都不一样。
n******r
发帖数: 13312
33
来自主题: Statistics版 - sas adv问题
。。。。这道题正确答案应该是哪个?有的说是b, 有的说c
Item 11 of 63 Mark item for review
The following SAS code is submitted:
data WORK.TEMP WORK.ERRORS / view=WORK.TEMP;
infile RAWDATA;
input Xa Xb Xc;
if Xa=. then output WORK.ERRORS;
else output WORK.TEMP;
run;
Which of the following is true of
the WORK.ERRORS data set?
A.
The data set is created when the
DATA step is submitted.
B.
The data set is created when the view
TEMP is used in anothe... 阅读全帖
k******u
发帖数: 250
34
来自主题: Statistics版 - 再问一个sas的处理
数据为csv file
如下:
123,"Harold Wilson",Acct,01/15/1989,$78,123.
128,"Julia Child",Food,08/29/1988,$89,123
007,"James bond",Security,02/01/2000,$82,1000
828,"Roger Doger",Acct,08/15/1999,$39,100
900,"Earl Davenport",Food,09/09/1989,$45,399
906,"James Swindler",Acct,12/21/1978,$78,200
comma是delimiter.
写了程序如下,
data Employ;
infile 'C:employee.txt' dsd;
input ID : $3.
Name : $20.
Depart : $8.
DateHire : mmddyy10.
salary : dollar8.
;
ru... 阅读全帖
d******9
发帖数: 404
35
来自主题: Statistics版 - 再问一个sas的处理
It is very annoying to deal with flat files.
One solution is to read in all the other variables using your code EXCEPT
the Salary. And use _N_ to tag the number of observations.
Then use below codes to read in the Salary column: Read the whole record as
one variable, then extract the dollar amount.
data Salary;
length raw $200;
infile cards missover ;
input raw : & $1-200;
N=_N_;
I=find(Raw, '$');
S= substr(Raw, I);
Salary=input(S, dollar12.);
cards;
123,"Harold Wilson",Acct,01/15/1989,$78,123.... 阅读全帖
d******9
发帖数: 404
36
来自主题: Statistics版 - 再问一个sas的处理
A better method:
You can read in the value of Salary into 2 separate vars, then concatenate
them together, and convert it into numeric by Input function.
data Employ;
infile cards dsd missover ;
input ID : $3.
Name : $20.
Depart : $8.
DateHire : mmddyy10.
S1 : $8. S2 : $8. ;
S=strip(S1) || strip(S2);
Salary=input(S, dollar12.);
cards;
123,"Harold Wilson",Acct,01/15/1989,$78,123.
128,"Julia Child",Food,08/29/1988,$89,123
007,"James bond",Security,... 阅读全帖
d********e
发帖数: 9
37
来自主题: Statistics版 - 求帮助:excel数据转csv和sas的读取
用infile来import数据可以么,然后可以在format里定义,比如format id Z15.之类的
p***7
发帖数: 535
38
来自主题: Statistics版 - ask for help on one SAS code
It should be simple for experienced programmers. The difficulty is the
special symbol in the pet_owner variable and its different length. In infile
command we could use $varying, but when it comes with cards/datalines, it
is clueless.
Please help!
Pet_owner pet number
Mr. Black dog 2
Mr. Black bird 1
Mrs. Green fish 5
Mr. White cat 3
j********t
发帖数: 201
39
来自主题: Statistics版 - ask for help on one SAS code
you might just read in all data first then process each record afterwards
using character functions or Perl Regular Expressions.

data one;
input title $ Pet_owner $ pet $ number;
length name $20.;
name=compress(title)||' '||compress(pet_owner);
cards;
Mr. Black dog 2
Mr. Black bird 1
Mrs. Green fish 5
Mr. White cat 3
;
run;
proc print;
title "data one: if one(or more) space(s) always exist(s) between the title
and the name";
run;
data two;
input title $ Pet_owner $ pet $ number;
length nam... 阅读全帖
c*********u
发帖数: 607
40
来自主题: Statistics版 - sas base question help (70)
29. The following SAS program is submitted;
data work.info;
infile 'datafile.txt';
input @1 company $20. @25 state $2. @;
if stat='' then input @30 year;
else input @30 city year;
input numemployees;
run;
how many raw data records are read during each iteration of the data step?
the answer is 1 but i think it's 2 since there's no @ at the if-then cycle.
t*****w
发帖数: 254
41
来自主题: Statistics版 - 问个 SAS转换数据的问题!
data test;
infile "C:Users.....temp.txt" dlm=",";
input x1$ ;
input x2 x3 x4 ;
run;
data test2;
set test;
var1=substr(x1, 1,1);
var2=substr(x1, 2);
run;
proc sql;
create table test3 as
select var1, var2, x2, x3, x4
from test2;
quit;
r**********y
发帖数: 49
42
Given the text file COLORS.TXT:
----+----1----+----2----+----
RED ORANGE YELLOW GREEN
BLUE INDIGO PURPLE VIOLET
CYAN WHITE FUCSIA BLACK
GRAY BROWN PINK MAGENTA
The following SAS program is submitted:
data WORK.COLORS;
infile 'COLORS.TXT';
input @1 Var1 $ @8 Var2 $ @;
input @1 Var3 $ @8 Var4 $ @;
run;
What will the data set WORK.COLORS contain?
A
Var1 Var2 Var3 Var4
------ ------ ------ ------
RED ORANGE RED ORANGE
BLUE IND... 阅读全帖
k******w
发帖数: 269
43
来自主题: Statistics版 - SAS 求助: filenames
filename lib pipe "dir C:Downloads*.dta /b";
data file;
length filenames $ 60;
infile lib truncover;
input filenames : $;
filenames="C:Downloads"||filenames;
run;
proc sort data=file; by filenames;run;
data null;
set file;
call symputx('file'||put(_n_,z2.),filenames,'G');
run;
_________________
假设我有21个files,从0.dta 到 20.dta
我希望能按数字顺序import到file里,可是结果顺序是:
0
1
11
12
13
.
.
.
19
20
21
3
4
5
...
哪位高手指点一下,多谢!
s******8
发帖数: 102
44
来自主题: Statistics版 - SAS 求助: filenames
也可加一个临时数字变量;
data file;
length filenames $ 60;
infile lib truncover;
input filenames : $;
nf=input(strip(scan(filenames,1,'.')),2.);
filenames="C:Downloads"||filenames;

run;
proc sort data=file; by nf;run;
data null;
set file;
call symputx('file'||put(_n_,z2.),filenames,'G');
run;
b*******z
发帖数: 155
45
来自主题: Statistics版 - 请问这道sas题目
data test;
infile datalines;
input a $ 20 b $;
datalines;
indepent va
;
run;
我run出来是报错的,0 obs
但是sas 123题的第33题答案是 有1个obs ,b是missing value
想确认下这种情况到底是0还是1呢
c**********2
发帖数: 62
46
来自主题: Statistics版 - 讨论3道SAS ADV题目
SAS ADV 63题网上的答案有很多版本,貌似都有一些错误。下面是我仍然拿不准的一些
题目。欢迎讨论,指正。等考完若有时间再把整理的63题答案发出来积点人品。
Item 1 of 63 Mark item for review
When attempting to minimize memory usage, the most efficient way to do group
processing whenusing the MEANS procedure is to use:
A. the BY statement.
B. GROUPBY with the NOTSORTED specification.
C.the CLASS statement.
D.multiple WHERE statements.
答案选C,个人也认为C是对的。网上有人提到过用Sort再means,这样A更快。但是题目
问的是memeory,不是时间,所以觉得还是应该选C。
Item 11 of 63 Mark item for review
The following SAS code is subm... 阅读全帖
w*****5
发帖数: 515
47
1) 一般大文件在UNIX服务器上,用命令: head -10 your_file>temp。然后download
这个有10行数据的小文件到PC上看。或者直接head -10 your_file在unix界面上看。
2)看你的文件格式,如果没有delimiter, 那么每个variable应该在固定的列数里,比
如jobtile在15列到30列,这时候要用@15 jobtile..这个information一般是事先给定
的。
d**m
发帖数: 42
48
来自主题: Statistics版 - 请教大家一个SAS问题
一个quiz的题不会,想请教大家一下,先多谢大家了!
The dataset below contains enrollment records for students. Write code to
count the number of days each student was enrolled. Include both the start
date and the end date in the count. Beware of overlapping date ranges. As an
example student 1’s count should be 6.
data Enrollment;
informat Start_Date MMDDYY10. End_Date MMDDYY10.;
format Start_Date MMDDYY10. End_Date MMDDYY10.;
infile datalines dlm=',';
input Student_Id Start_Date End_Date;
... 阅读全帖
d*********d
发帖数: 239
49
来自主题: Statistics版 - SAS用table editor 能生成.dat 格式吗?
请教:
SAS 用table editor 能生成.dat 格式吗? 发现生成的都是.sas7bdat格式。这个和.
dat有什么不同吗? 我试图用infile 语句貌似对.sas7bdat文件不可以。是这样吗?
我是弱爆初学者,请大虾们指导一下。
谢谢。
N***3
发帖数: 801
50
来自主题: Statistics版 - 问个SAS 问题
data a;
infile cards dlm=' ' missover;
input ID ID_SQ TREATMENT $ Detail $;
cards;
1 1 A
1 2 B 100
2 1 A
2 2 B 101
3 1 A
3 2 B 110
3 3 A
3 4 B 101
;
data b (drop=id_sq_lag);
set a;
ID_SQ_Lag=lag(ID_SQ);
if treatment='B' then
do;
output;
ID_SQ=ID_SQ_Lag;
treatment='A';
output;
end... 阅读全帖
首页 上页 1 2 3 4 5 6 7 (共7页)